Created
March 20, 2024 10:38
-
-
Save foru17/b01a2d3a1d07ba0ae6c3b4284fe15e10 to your computer and use it in GitHub Desktop.
reset git user name and email
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
git filter-branch --env-filter ' | |
OLD_NAME="old_name" | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="luolei" | |
CORRECT_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_NAME" = "$OLD_NAME" ] && [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
fi | |
if [ "$GIT_AUTHOR_NAME" = "$OLD_NAME" ] && [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_AUTHOR_NAME="$CORRECT_NAME" | |
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" | |
fi | |
' --tag-name-filter cat -- --branches --tags | |
# git push origin master --force | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment