Skip to content

Instantly share code, notes, and snippets.

@atosatto
Created July 4, 2016 17:07
Show Gist options
  • Save atosatto/c0dd6a3545e0330aa4dc26c6ccef4b9f to your computer and use it in GitHub Desktop.
Save atosatto/c0dd6a3545e0330aa4dc26c6ccef4b9f to your computer and use it in GitHub Desktop.
Change the timestamp of previous Git commits
# Git has two different types of timestamp associated with a commit.
# Although both may typically hold the same value they are used in subtly different ways.
# The author (GIT_AUTHOR_DATE) is the user who originally created the work (i.e. a patch),
# where as the committer (GIT_COMMITTER_DATE) is the user who last applied the
# work (i.e. applied patch or rebase).
git filter-branch --env-filter \
"if test \$GIT_COMMIT = 'e6dbcffca68e4b51887ef660e2389052193ba4f4'
then
export GIT_AUTHOR_DATE='Sat, 14 Dec 2013 12:40:00 +0000'
export GIT_COMMITTER_DATE='Sat, 14 Dec 2013 12:40:00 +0000'
fi" && rm -fr "$(git rev-parse --git-dir)/refs/original/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment