Google Codeから移行したGithub上のコミット情報を修正する

Google CodeからGithubに移行した際に、Subversionだとコミット時のAuthorが引き継がれません。(Subversionだとアドレス情報を持たないので、アカウント名をもとにした適当なアドレス(onozaty@d69323c3-784f-0410-8b25-87718e594ec8とか)に変換される)

ということでGithub上のアカウントとマッピングしたい場合には、コミット情報を修正する必要があります。

変更のしかたは、Githubのヘルプにも手順として詳しく書かれていたので、特にはまることなく変更できました。

onozaty/hip3.git を変更したときは、下記のような感じでした。

[root@localhost ~]# git clone --bare https://onozaty@github.com/onozaty/hip3.git
Initialized empty Git repository in /root/hip3.git/
Password:
remote: Counting objects: 70, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 70 (delta 22), reused 66 (delta 21), pack-reused 0
Unpacking objects: 100% (70/70), done.
[root@localhost ~]# cd hip3.git/
[root@localhost hip3.git]# emacs replace.sh
#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="onozaty@d69323c3-784f-0410-8b25-87718e594ec8"
CORRECT_NAME="onozaty"
CORRECT_EMAIL="onozaty@gmail.com"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
[root@localhost hip3.git]# sh replace.sh
Rewrite 2cb9fe8ae033c237f4d509aebffdf821b6b52eec (8/8)
Ref 'refs/heads/master' was rewritten
WARNING: Ref 'refs/heads/wiki' is unchanged
Ref 'refs/tags/release' was rewritten
[root@localhost hip3.git]# git remote add origin https://onozaty@github.com/onozaty/hip3.git
[root@localhost hip3.git]# git push --force --tags origin 'refs/heads/*'
Password:
Counting objects: 67, done.
Compressing objects: 100% (50/50), done.
Writing objects: 100% (67/67), 1.63 MiB | 71 KiB/s, done.
Total 67 (delta 13), reused 0 (delta 0)
To https://onozaty@github.com/onozaty/hip3.git
 + 15e6c48...65fa32c master -> master (forced update)
 + 0fa0e39...eb97f80 release -> release (forced update)
[root@localhost hip3.git]#

ちなみに、コミット情報が160くらいのリポジトリを修正したときに、git pushが1時間以上かかりました…