Last active
December 2, 2022 03:06
-
-
Save tutumagi/3d1761ac4e921d525cf98a399a99f770 to your computer and use it in GitHub Desktop.
modify commit usr #git
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
#!/bin/sh | |
## 1. git clone --bare your_git_repo | |
## 2. modify the script below | |
## 3. git push --force --tags origin 'refs/heads/*' | |
## 4. remove your temp git_repo dir | |
git filter-branch --env-filter ' | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="lisi" | |
CORRECT_EMAIL="[email protected]" | |
# 可以通过或关系重写多个用户名 | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
fi | |
if [ "$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment