I am using this script found at this link to edit author info across all commits.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
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
However, I am getting the following error(warning?):
Cannot create a new backup.
A previous backup already exists in refs/original/
Force overwriting the backup with -f
I checked the log too. The author info didn't change. What am I doing wrong here?
Update: As mentioned by @elpiekay, the -f
flag made the script work.
But can anyone explain the error log itself? Why does it mention about backup ? I never made any backup before (unsure what backup is being referred in the error log)
-f
as the error log suggested? – Bardgit filter-branch
successfully, one or more refs are rewritten and backups are created for each of them. When you run it again, the backups will be overwritten, which means the previous backups will seem lost. Although it's still possible to find them back, it's just troublesome. The command fails unless the user specifically uses-f
to instruct it to overwrite the previous backups. – Bard