Git cheats: Change date of existing commit

This commit is contained in:
Shadab Zafar 2015-08-03 17:44:58 +05:30
parent b477df20b2
commit 6cf69bc190
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,14 @@ git commit --date="`date --date='2 day ago'`"
git commit --date="Jun 13 18:30:25 IST 2015"
# more recent versions of Git also support --date="2 days ago" directly
# To change the date of an existing commit
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'
# To removed staged and working directory changes
git reset --hard