Skip to content

Instantly share code, notes, and snippets.

@karthikax
Last active October 27, 2017 12:17
Show Gist options
  • Save karthikax/b4b8487e5aa89e95bf8c16a5b5fe6894 to your computer and use it in GitHub Desktop.
Save karthikax/b4b8487e5aa89e95bf8c16a5b5fe6894 to your computer and use it in GitHub Desktop.
Git commit in the past
cd path/to/git/project
export GIT_COMMITTER_DATE="YYYY-MM-DD HH:MM:SS"
export GIT_AUTHOR_DATE="YYYY-MM-DD HH:MM:SS"
git commit --amend --date=""YYYY-MM-DD HH:MM:SS"
# Verify date and time then save.
unset GIT_COMMITTER_DATE
unset GIT_AUTHOR_DATE
cd path/to/git/project
export GIT_COMMITTER_DATE="YYYY-MM-DD HH:MM:SS"
export GIT_AUTHOR_DATE="YYYY-MM-DD HH:MM:SS"
git commit -am "Message"
unset GIT_COMMITTER_DATE
unset GIT_AUTHOR_DATE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment