0
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?

More than 3 years have passed since last update.

gitでauthorを間違えてコミットしちゃって手遅れなとき

Last updated at Posted at 2020-05-21

要旨

誤った名前でコミットしたとき、名前(過去のすべてのAuthor)を変更したいときは、
ターミナルで以下のように指定する。

$  git filter-branch -f --env-filter "GIT_AUTHOR_NAME='ajimarusyokudo'; GIT_AUTHOR_EMAIL='valid_email@example.com'; GIT_COMMITTER_NAME='ajimarusyokudo'; GIT_COMMITTER_EMAIL='valid_email@example.com';" HEAD

実例

誤ってMona Lisaとして挙げてしまったとき(ほんとはMilk Boyなのに)の修正
image.png

以下をターミナルで叩く

$  git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Milk Boy'; GIT_AUTHOR_EMAIL='milkboy@example.com'; GIT_COMMITTER_NAME='Milk Boy'; GIT_COMMITTER_EMAIL='milkboy@example.com';" HEAD

image.png

注意

変更がコミットされていないと怒られるので、.gitnoreに追加するか、退避させることが必要
(怒られるときとそうでないときがある、原因不明)

参考

0
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
0
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?