How can one change the timestamp of an old commit in Git? -


the answers how modify existing, unpushed commits? describe way amend previous commit messages haven't yet been pushed upstream. new messages inherit timestamps of original commits. seems logical, there way re-set times?

use git filter-branch env filter sets git_author_date , git_committer_date specific hash of commit you're looking fix.

this invalidate , future hashes.

example:

if wanted change dates of commit 119f9ecf58069b265ab22f1f97d2b648faf932e0, this:

git filter-branch --env-filter \     'if [ $git_commit = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ]               export git_author_date="fri jan 2 21:38:53 2009 -0800"          export git_committer_date="sat may 19 01:01:01 2007 -0700"      fi' 

Comments