Is it possible to mass-rename 2 or more email addresses with a single pass of git filter-branch
?
I tried adapting the code from this answer by just duplicating the if..fi clause
:
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "<Old Name 1>" ];
then
GIT_COMMITTER_NAME="<New Name 1>";
GIT_AUTHOR_NAME="<New Name 1>";
GIT_COMMITTER_EMAIL="<New Email 1>";
GIT_AUTHOR_EMAIL="<New Email 1>";
git commit-tree "$@";
else
git commit-tree "$@";
fi
if [ "$GIT_COMMITTER_NAME" = "<Old Name 2>" ];
then
GIT_COMMITTER_NAME="<New Name 2>";
GIT_AUTHOR_NAME="<New Name 2>";
GIT_COMMITTER_EMAIL="<New Email 2>";
GIT_AUTHOR_EMAIL="<New Email 2>";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
But it gave me errors during the filter-branch that looked like this:
error: duplicate parent bc8f9924c33558a275b8f694969529cf56232c80 ignored
And then the branch history was all tangled up: