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

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git http://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git

Answers

Use git filter-branch with an env filter that sets GIT_AUTHOR_DATE and GIT_COMMITTER_DATE for the specific hash of the commit you re looking to fix.

This will invalidate that and all future hashes.

  Example:   

https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats

git filter-branch --env-filter 
     if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ]
     then
         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 

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils