Last active
February 12, 2016 19:20
-
-
Save codeaid/03ec04e9ce1d63fa9f34 to your computer and use it in GitHub Desktop.
Update git commit names and emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# More information @ http://schacon.github.io/git/git-filter-branch.html | |
# | |
# Rewrite using environment filter | |
git filter-branch --env-filter \ | |
'if [ $GIT_COMMITTER_EMAIL = [email protected] ]; | |
then | |
GIT_COMMITTER_NAME="New Name"; | |
[email protected]; | |
GIT_AUTHOR_NAME="New Name"; | |
[email protected]; | |
fi; | |
export GIT_COMMITTER_NAME; | |
export GIT_COMMITTER_EMAIL; | |
export GIT_AUTHOR_NAME; | |
export GIT_AUTHOR_EMAIL;' \ | |
-f | |
# Rewrite using commit filter | |
git filter-branch --commit-filter \ | |
'if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; | |
then | |
export GIT_AUTHOR_NAME="New Name"; | |
export [email protected]; | |
export GIT_COMMITTER_NAME="New Name"; | |
export [email protected]; | |
fi; | |
git commit-tree "$@"' | |
# Only rewrite the name | |
git filter-branch --commit-filter \ | |
'if [ "$GIT_COMMITTER_NAME" = "Old Name" ]; | |
then | |
export GIT_AUTHOR_NAME="New Name"; | |
export GIT_COMMITTER_NAME="New Name"; | |
fi; | |
git commit-tree "$@"' | |
# Only rewrite the email | |
git filter-branch --commit-filter \ | |
'if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; | |
then | |
export [email protected]; | |
export [email protected]; | |
fi; | |
git commit-tree "$@"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment