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

git の過去のコミットのメールアドレスを修正

Posted at

目的

git の過去のコミットのメールアドレスを修正

手順

タグ名は維持しつつ、コミットのメールアドレスだけ変更する。

git filter-branch --env-filter '
CORRECT_NAME="Your Name"
CORRECT_EMAIL="xxx@xxx.com"

export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
' --tag-name-filter cat -- --branches --tags

すでに push していた場合、上書きするには、--force オプション必要。

git push origin main --force 

今後のコミットのメールアドレスも変更しておく。

git config --global user.name "Your Name"
git config --global user.email "xxx@xxx.com"
0
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
0
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?