Skip to content

Instantly share code, notes, and snippets.

@jyhsu2000
Created January 26, 2018 12:46
Show Gist options
  • Save jyhsu2000/4812eaffa29f8edd50578a044141e370 to your computer and use it in GitHub Desktop.
Save jyhsu2000/4812eaffa29f8edd50578a044141e370 to your computer and use it in GitHub Desktop.
# clear previous backup
rm -rf "$(git rev-parse --git-dir)/refs/original/"
commit="$1"
date=$(date -d "$2" +%s)
git filter-branch --env-filter \
"if [ \$GIT_COMMIT = '$commit' ]; then
export GIT_AUTHOR_DATE='$date'
export GIT_COMMITTER_DATE='$date'
export GIT_COMMITTER_NAME="\$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="\$GIT_AUTHOR_EMAIL"
fi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment