Skip to content

Instantly share code, notes, and snippets.

@ManasMadrecha
Last active July 9, 2021 22:22
Show Gist options
  • Save ManasMadrecha/a87487f8ff12cc546f5814886d1aae27 to your computer and use it in GitHub Desktop.
Save ManasMadrecha/a87487f8ff12cc546f5814886d1aae27 to your computer and use it in GitHub Desktop.
Git author date and commit date

Why Git author date and commit date are different?

https://stackoverflow.com/questions/11856983/why-git-authordate-is-different-from-commitdate

The author date notes when this commit was originally made (i.e. when you finished the 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.

Github

Github displays commits based on commit date.

So, after a rebase, your commits timeline will be messed up on Github, though in reality, by git log you can see your author date is intact.

https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/troubleshooting-commits-on-your-timeline

How to set Git commit date same as author date

You may want to do this to rectify the GitHub's commits timeline.

https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date

git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment