Skip to content

Instantly share code, notes, and snippets.

@yaodong
Created January 10, 2015 16:16
Show Gist options
  • Save yaodong/1ddf99771169628ea730 to your computer and use it in GitHub Desktop.
Save yaodong/1ddf99771169628ea730 to your computer and use it in GitHub Desktop.
replace email in git history
#!/usr/bin/env bash
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ];
then
GIT_COMMITTER_NAME="YOUR NAME";
GIT_AUTHOR_NAME="YOUR NAME";
GIT_COMMITTER_EMAIL="[email protected]";
GIT_AUTHOR_EMAIL="[email protected]";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment