2
1

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 2021-03-01

自環境以外の環境で開発作業をしていてGitにコミットする時はAuthor情報を自分の情報に直して1からコミットするのが正しいやり方ですが、うっかり直し忘れてコミットをしてしまった後に気付いた場合、1つだけならgit commit --amend --author="Auter's Name<author@email.com>"で修正出来ますが、修正箇所が多数の場合は以下の様にします。

git filter-branch -f --env-filter "GIT_AUTHOR_NAME='new_user_name'; GIT_AUTHOR_EMAIL='new_email'; GIT_COMMITTER_NAME='old_user_name'; GIT_COMMITTER_EMAIL='old_email';" HEAD
  • old_user_namenew_user_nameに、old_emailnew_emailに書き換わります。

Reference

  1. git config --local user.name="User Name", git config --local user.email="user@email.com"で作業リポジトリ限定でユーザー情報を自分の情報に変更出来ます。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?