Git

Git commit push 내용 변경

Whatman 2022. 4. 29. 14:47

1. rebase를 이용한 author 및 commit 내용 변경

 

$ git rebase -i --root						# --root : 처음부터 끝까지
$ # git rebase -i 824a488df15c65176559797364f575ebe51d5f98	# hash값 넣을시 최신으로부터 hash값 전부터 시작
$ # vi가 열리면 :%s/pick/e 변경 후 :wq

$ git commit --no-edit --amend --author="whatman <whatman@google.com>"
$ git rebase --continue
$ git commit --no-edit --amend --author="whatman <whatman@google.com>"
$ git rebase --continue
$ #				.... 계속 반복
$ git commit --amend --author="whatman <whatman@google.com>"	#  commit 내용 변경하고 싶을 시
$ git push origin +master					# +master : force push