git-time-metric / gtm

Simple, seamless, lightweight time tracking for Git
MIT License
973 stars 52 forks source link

`git reset HEAD~` deletes recorded time #89

Open diego-betto opened 5 years ago

diego-betto commented 5 years ago

I've noticed that if you use git reset HEAD~ to undo a commit will result in a lost of gtm entries.

Any clue?

mschenk42 commented 5 years ago

That is correct. When you commit, gtm calculates the commit time (via a post-commit hook) and files based on what is in the .gtm directory in the root of the project and then removes the processed editor events. The time is then stored in a git note associated with the commit. If you reset HEAD~1 it doesn't have anyway to restore the original editor events that are used to calculate the time.