git의author와committer 변경

2482 단어 Git

블로그의 동기


실수로 회사 컴퓨터에 개인 Git를 제출하면 author 과 commiter 회사 물건이 된다!
매번 author과commiter를 수정해야 하는데 가장 중요한 명령이 바로 격자될 줄은 몰랐어요...나는 다시는 불평하고 싶지 않다고 맹세한다. 내가 쓴 필기로 정리해 보자.

git 제출 로그 검사

$ git log --pretty=full
commit 186543f9bece44383ab973dc0253946bf09b159f
Author: 会社の <会社の@example.com>
Commit: 会社の <会社の@example.com>

    commit message2

commit 25ddf087cfe17f7f71c1fd273eed931b39c71a4b
Author: 自分の <自分の@example.com>
Commit: 自分の <自分の@example.com>

    commit message1

author만 변경

git rebase -i <修正したいコミットの一個前のコミットハッシュ>예를 들어, 변경된 경우commit message2author
1. git rebase -i 25ddf087cfe17f7f71c1fd273eed931b39c71a4b

で修正したい対象のpick -> edit

2. git commit --amend --author="自分の<自分の@example.com>"

3. git rebase --continue

author와committer를 동시에 변경합니다


git config 수정


config를 올바른 상태로 설정합니다.
local config 검증 방법:git config --local --list
$ git config --local user.name 自分の
$ git config --local user.email 自分の@example.com

로그 수정

1.git rebase -i <commit hash>

2.git commit --amend --reset-author これを実行することで、一発でcommiterとauthorが修正できる

3.git rebase --continue

4.git log --pretty=full で正しく修正されたのを確認
복구됨

지원


동적 입력 프롬프트에서 클릭git rebase -i --root <commit hash>사용자 정의 모양새를 정의합니다.

좋은 웹페이지 즐겨찾기