GitHub commit dates
A git commit has an author date
and commit date
; the two differ in situations such as squashing, where the author date precedes the commit date (the timestamp of the squashing). While git log
shows the author date, a GitHub repo’s commit history displays the commit date.
To change the commits such that the commit date matches the author date, this flag can be added to git rebase
:
git rebase --committer-date-is-author-date HEAD~4
Force push the commits to update the remote repo.
For more precision:
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' HEAD~4..HEAD
HEAD~4..HEAD
can be omitted to update all commits in the repo history.