The scripting used by git filter-branch
is simply a snippet of sh
, which means that all capabilities of sh
and any commands you can call from it (echo
, grep
, sed
, etc.) are at your disposal. To implement wildcard matches, you don't need to invoke external commands, as sh
provides the somewhat clumsy but useful case
command. In your case (no pun intended), it could look like this:
git filter-branch --commit-filter '
case "$GIT_AUTHOR_NAME" in
*[Gg]iovanni*[Aa]zua*)
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 "$@"
;;
*)
git commit-tree "$@"
;;
esac
' HEAD
The above will change all commits whose author name contains giovanni
or Giovanni
and azua
or Azua
(in that order) anywhere in the author name.