1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Gitで過去の自分のコミット全てのメールアドレスを変更したい

Posted at

備忘録として。たぶん新しいより優れたやり方があるはずだけど、「なんでもいいから今すぐ動く 過去の自分のコミット全てのメアド変更コマンド くれよ!」という時に...

結論

こう

git filter-branch --env-filter 'if [ "$GIT_COMMITTER_EMAIL" = "old_email@example.com" ]; then export GIT_COMMITTER_EMAIL="new_email@example.com"; fi; if [ "$GIT_AUTHOR_EMAIL" = "old_email@example.com" ]; then export GIT_AUTHOR_EMAIL="new_email@example.com"; fi' -- --all

実行すればローカルにある過去の全コミットのうち、 old_email@example.com がメールアドレスのコミットを、 new_email@example.com に変えてくれる。

リモートも変えたければこれを強制pushすればOK!...とはいえチーム開発での強制pushは常にリスクを伴うので、問題ない状態にしてからやるのを推奨。いわゆる自己責任で...ってやつですね。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?