Last active
August 4, 2021 13:44
-
-
Save shawnfeng0/1be10436a5843b7e796345221f881052 to your computer and use it in GitHub Desktop.
change git commit message
This file contains hidden or 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 | |
if [ $# -lt 3 ] ; then | |
echo "Usage: $0 old_email new_email new_name" | |
echo "Example: $0 [email protected] [email protected] new_name" | |
exit 1; | |
fi | |
echo "old_email: $1" | |
echo "new_email: $2" | |
echo "new_name: $3" | |
export OLD_EMAIL="$1" | |
export CORRECT_EMAIL="$2" | |
export CORRECT_NAME="$3" | |
git filter-branch --force --env-filter ' | |
#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