Skip to content

Instantly share code, notes, and snippets.

@st3v
Last active March 31, 2021 01:54
Show Gist options
  • Save st3v/4689877 to your computer and use it in GitHub Desktop.
Save st3v/4689877 to your computer and use it in GitHub Desktop.
Manipulate Git Commit Dates
# Setting date at commit time:
GIT_COMMITTER_DATE="Tue Feb 7 22:47:34 2012 -0800" git commit -m "Ignore stuff" --date "Tue Feb 7 22:47:34 2012 -0800"
# Changing date for historical commit:
git filter-branch --env-filter 'if [ $GIT_COMMIT = <commit-id> ]
then
export GIT_AUTHOR_DATE="Tue Feb 7 22:47:34 2012 -0800"
export GIT_COMMITTER_DATE="Tue Feb 7 22:47:34 2012 -0800"
fi' -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment