Last active
September 9, 2023 15:21
-
-
Save jsyzdek/30a018a4311f8fdf479bab8ffeb2230f to your computer and use it in GitHub Desktop.
git rename person
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
# This allows you to go back and rewrite the commiters in your | |
# git history. For example, if you accidentally had "server" | |
# as your git name. | |
# | |
# You can put this in a shell script or run from the command line, | |
# just be sure to change the values first of course. | |
git filter-branch --env-filter ' | |
WRONG_EMAIL="wrong@example.com" | |
NEW_NAME="New Name Value" | |
NEW_EMAIL="correct@example.com" | |
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$NEW_NAME" | |
export GIT_COMMITTER_EMAIL="$NEW_EMAIL" | |
fi | |
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ] | |
then | |
export GIT_AUTHOR_NAME="$NEW_NAME" | |
export GIT_AUTHOR_EMAIL="$NEW_EMAIL" | |
fi | |
' --tag-name-filter cat -- --branches --tags | |
#### Don't forget to set your username and email: | |
git config --global user.name "Name" | |
git config --global user.email "email" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment