I’m trying to re-write a repo’s history using:
git filter-branch -f --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [[ "$GIT_COMMITTER_EMAIL" = jacks* ]]
then
cn="Jack Slingerland"
cm="jacks@teamddm.com"
an="Jack Slingerland"
am="jacks@teamddm.com"
fi
if [[ "$GIT_AUTHOR_EMAIL" = jacks* ]]
then
cn="Jack Slingerland"
cm="jacks@teamddm.com"
an="Jack Slingerland"
am="jacks@teamddm.com"
fi
export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"'
-- --all
The command runs fine, and rewrites the author as specified. The problem is that it seems to miss some entries in the history. I think it’s happening when changes made in a branch were merged in, but I’m not sure.
Note: This is an SVN repository that was imported into Git using Git+SVN.
I don’t think your conditionals are checking what you want. Shouldn’t:
be
Note: this will only work in Bash 3.0 or higher. Otherwise I think you’ll need to use
greporsedexternal commands as part of your conditional checks.Also, I think you will only want to change the commiter when the commiter’s email isn’t Jack’s and vice versa for the author. So make sure you take out your
anandamassignments in your comitter email check and make the similar fix to your author email check.