If you need to edit the commit author on your local repository, you can use the command below in your terminal:
git filter-branch -f --env-filter '
OLD_EMAIL="oldemail@email.com"
CORRECT_NAME="Azis Hapidin"
CORRECT_EMAIL="newemail@azishapidin.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
' HEAD
Note:
- Replace oldemail@email.com with current author.
- Replace Azis Hapidin with new author name.
- Replace newemail@azishapidin.com with new author email.