Why is git AuthorDate different from CommitDate?

The author date notes when this commit was originally made (i.e. when you finished the git commit). According to the docs of git commit, the author date could be overridden using the --date switch.

The commit date gets changed every time the commit is being modified, for example when rebasing the branch where the commit is in on another branch (more).

Same could happen if you make your commit and send your patch to another one in order to apply the patch in another repo: the author date will be the date of your git commit, the commit date will be set to that date when the patch is applied in the other repo.

If you send the patch to two colleagues, there will be one author date but two different commit dates.

This is also mentioned in the Git Book:

You may be wondering what the difference is between author and committer. The author is the person who originally wrote the patch, whereas the committer is the person who last applied the patch. So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit — you as the author and the core member as the committer

Leave a Comment

tech