スクリプト
#!/bin/sh
if [ $# -ne 3 ]; then
echo '引数は、変更元コミッターネーム、変更先名前、変更先メールアドレスの順です。' 1>&2
exit 1
fi
git filter-branch -f --commit-filter "
if [ \"\$GIT_COMMITTER_NAME\" = '$1' ]; then
GIT_COMMITTER_NAME='$2'
GIT_COMMITTER_EMAIL='$3'
GIT_AUTHOR_NAME='$2'
GIT_AUTHOR_EMAIL='$3'
fi
git commit-tree \"\$@\"
" HEAD
3 行で使えます。
.git ディレクトリが置かれているディレクトリで実行してください。
curl -LSfs -o change_git_committer_and_author.sh https://raw.githubusercontent.com/wsjdev/scripts/master/change_git_committer_and_author.sh
sh change_git_committer_and_author.sh 'bad_name' 'good_name' 'good@email.dayo'
rm change_git_committer_and_author.sh
効果
第一引数と committer name が一致したコミットの
committer name
author name
を第二引数
committer email
author email
を第三引数に変更します。