- copy the below code in a file and save it in .sh extension.
- Configure your
OLD_MAIL
,CORRECT_NAME
andCORRECT_EMAIL
and save the file. - This file should be in your directory whose correction you want to do.
- run this file
bash fileName.sh
or./filename
- force push the repo.
git push -f origin master
Last active
May 19, 2019 08:42
-
-
Save shellkore/028f0d1e91fe8eba1c1da6c4fb925d5b to your computer and use it in GitHub Desktop.
If you forget to change your name and email intially and made several commits. So, to correct those you can use this script.
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 | |
git filter-branch -f --env-filter ' | |
OLD_EMAIL="oldMail@example.com" | |
CORRECT_NAME="correctName" | |
CORRECT_EMAIL="newMail@example.com" | |
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