I was writing a simple script in the school computer, and committing the changes to Git (in a repo that was in my pendrive, cloned from my computer at home). After several c
You can use this as a alias so you can do:
git change-commits GIT_AUTHOR_NAME "old name" "new name"
or for the last 10 commits:
git change-commits GIT_AUTHOR_EMAIL "old@email.com" "new@email.com" HEAD~10..HEAD
Add to ~/.gitconfig:
[alias]
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" $@; }; f "
Source: https://github.com/brauliobo/gitconfig/blob/master/configs/.gitconfig
Hope it is useful.