2024-01-14
Git Author Date and Commit Date
While taking part in some tomfoolery, I came to know that there are 2 different dates in git log
. Git, by default, shows the AuthorDate
, so we have to pass an additional flag git log --pretty=fuller
to see both. GitHub uses the CommitDate
on the site by default which sometimes can be confusing.
After a quick search, I found this StackOverflow answer explaining the differences and leading to https://stackoverflow.com/questions/18750808/difference-between-author-and-committer-in-git.
All of this started with this snippet that I found on StackOverflow to modify the dates of a specific commit.
git filter-branch --env-filter \
'if [ $GIT_COMMIT = bad3bc83a21ee06e0dd0d12d2c8aac1a3450bcea ]
then
export GIT_AUTHOR_DATE="Mon Nov 23 14:38:53 2020 +0530"
export GIT_COMMITTER_DATE="Mon Nov 23 14:38:53 2020 +0530"
fi'