2

I observe a strange behavior in my git history:

I can commit as normal using git gui and author date and committer date are correctly when viewed in gitk.

But as soon as I perform an amend via git gui or an rebase via the git bash, all subsequent commits have the committer date correct and the author date being the same as the last commit before this rewrite process - sometimes several days in the past.

When I close git-gui, gitk and their parent git bash and reopen them, the date for the next commits is correct again - up until the next rebase/amend

git-gui version 0.20.GITGUI (Used under Windows)

git version 2.10.0.windows.1 (x64 bit)

PhilLab
  • 4,777
  • 1
  • 25
  • 77
  • Does this happen if you do a rebase via the git bash, without having used the git gui first? I'm curious about how many ways this bug/environment polluter is snuck in. – Superole Nov 29 '16 at 13:11
  • 1
    It seems to be that it only happens with the gui open first. And I also don't have to close gui and bash to have it working again - restarting the gui is sufficient – PhilLab Nov 29 '16 at 13:32
  • great. Thank you. :D – Superole Nov 29 '16 at 13:43

2 Answers2

1

Reason

This is caused by a bug in Git Gui (in Git for Windows >=v2.8.2.windows.1) that sets the environment variables GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE when you commit with ammend. These variables override all author-settings for any operation that creates commits, like rebase, commit, merge etc.

Fix

This should be fixed in the next version (v2.11.x ?) of G4W.

Workaround

Close Git Gui immediately after a commit with ammend.

Superole
  • 1,329
  • 21
  • 29
  • Thanks. Do you have a link to the bugtracker? – PhilLab Dec 20 '16 at 10:55
  • 1
    Seems to be fixed in v2.11.0 - at least I did not observe this behavior anymore since updating – PhilLab Dec 21 '16 at 15:56
  • @PhilLab that's good to hear. This bug was not tracked per se, but it was mentioned as a side effect here https://github.com/git-for-windows/git/issues/761 – Superole Dec 23 '16 at 23:48
-1

This behavior is by design. Git has separate values for author date and committer date.

Author date reflects the time this commit was created for the first time, and it is preserved.

Committer date is updated every time you amend, rebase etc.

To see both, git log --pretty=fuller.

If you want to reset the author time, git commit --amend --reset-author.

orgads
  • 678
  • 8
  • 21
  • Okay, I get that for the commits I changed afterwards. But for all **new** commits I create afterwards, the time stays fixed in the past – PhilLab Sep 30 '16 at 08:11
  • Oh, that's a bug in git gui then. The environment variables should be unset after committing. – orgads Oct 01 '16 at 17:03