Created
March 4, 2019 09:36
-
-
Save apaatsio/a7c6a8b7b2eb4fa53ceb0556c3456ee5 to your computer and use it in GitHub Desktop.
Change any git commit date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STEP 1 | |
# To change non-root commit | |
git rebase -i f154548^ | |
# Alternatively, to change the root commit | |
git rebase -i --root | |
# STEP 2 | |
# edit the commit you want to change by changing the line | |
pick f154548 This is a commit message | |
# to | |
edit f154548 This is a commit message | |
# and save&exit | |
# STEP 3 | |
NEW_DATE="Thu Feb 14 19:59:59 2019 -0800" # custom date | |
# or alternatively | |
NEW_DATE="$(date)" # current date | |
GIT_AUTHOR_DATE="$NEW_DATE" GIT_COMMITTER_DATE="$NEW_DATE" git commit --amend --no-edit --date "$NEW_DATE" | |
git rebase --continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment