I have a problem similar to the one described in question How do I change the author of a commit in git? and the solution I'm trying is using git filter-branch
but it doesn't work because it won't match the string literal with spaces i.e. I need contains
:
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "giovanni azua" ];
then
GIT_COMMITTER_NAME="Giovanni Azua";
GIT_COMMITTER_EMAIL="giovanni.azua@xxx.com";
GIT_AUTHOR_NAME="Giovanni Azua";
GIT_AUTHOR_EMAIL="giovanni.azua@xxx.com";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
The equal sign will not work if there are spaces in between and I have no idea how to escape it. I have also tried escaping it like giovanni\ azua
but doesn't work. I also could not find any reference to what this scripting is i.e. how do you do string contains
or substring
match? I always get the output WARNING: Ref 'refs/heads/master' is unchanged
.
UPDATE: It would also check my box to have a not if [ "$GIT_AUTHOR_NAME" ~= "giovanni azua" ];
but the operator ~=
does not work.