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="[email protected]"
CORRECT_NAME="Azis Hapidin"
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
' HEAD
Note:
- Replace [email protected] with current author.
- Replace Azis Hapidin with new author name.
- Replace [email protected] with new author email.