Change the date of a commit in Git
It's generally never a good idea to do it, but I found one case it was useful.
A commit has two dates: the author date, and the commit date.
To rebase to the commit:
1. git rebase -i <hash of the commit to change>
2. select to edit only that commit
To change only the commit date:
git commit --amend --date "`date -R`"
To change both author and commit dates:
GIT_COMMITTER_DATE="`date-R`" git ci --amend --date "`date -R`"
End the rebase with git commit --continue
.
Written by Lucia Escanellas
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Commit
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#