I looked in my git logs and found that the AuthorDate and CommitDate is slightly different for some of my commits. From the git log --pretty=fuller
output:
commit 3a5912f90dc5227f308e99f95152fbee2301c59a
Author: <hidden>
AuthorDate: Fri Jun 15 10:57:22 2012 +0800
Commit: <hidden>
CommitDate: Fri Jun 15 11:14:37 2012 +0800
The Author and Commit is the same (me).
How does this happen? I have been puzzled for days.
There are more - it happened in 17 out of 341 commits:
+------------------------------+-------------------------------+
| from_unixtime(authored_date) | from_unixtime(committed_date) |
+------------------------------+-------------------------------+
| 2012-06-15 10:57:22 | 2012-06-15 11:14:37 |
| 2012-06-15 14:39:54 | 2012-06-15 14:48:57 |
| 2012-06-19 12:28:21 | 2012-06-19 12:29:41 |
| 2012-06-21 18:16:25 | 2012-06-21 18:28:48 |
| 2012-06-26 17:30:54 | 2012-06-26 17:33:55 |
| 2012-07-13 11:41:43 | 2012-07-13 11:42:17 |
| 2012-07-13 11:56:02 | 2012-07-13 12:13:22 |
| 2012-07-13 12:05:09 | 2012-07-13 12:12:24 |
| 2012-07-12 18:38:49 | 2012-07-13 12:26:35 |
| 2012-07-13 11:00:47 | 2012-07-13 12:25:15 |
| 2012-07-16 14:10:54 | 2012-07-16 14:15:01 |
| 2012-07-13 12:56:51 | 2012-07-16 13:49:48 |
| 2012-07-16 14:10:54 | 2012-07-16 14:19:46 |
| 2012-07-24 16:05:05 | 2012-07-24 16:05:48 |
| 2012-07-24 17:42:58 | 2012-07-24 17:43:33 |
| 2012-07-24 17:42:58 | 2012-07-24 17:45:18 |
| 2012-07-26 16:55:40 | 2012-07-26 16:55:53 |
+------------------------------+-------------------------------+
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