git commit 메시지 수정

seheeee_97·2023년 12월 6일
0

git

목록 보기
4/7

마지막 commit의 메시지를 수정할 경우

git commit --amend -m "바꿀 커밋 메시지 내용"

마지막 이전 commit 메시지 수정

git rebase -i HEAD~4	//HEAD에서 n번째 떨어진 메시지까지 보여줌

pick 커밋번호 feat: 커밋메시지
pick 9e65cc feat: setting
pick 9076a9 feat: message

에서 i를 눌러 수정모드 진입
pickreword로 변경

pick 커밋번호 feat: 커밋메시지
reword 9e65cc feat: setting
pick 9076a9 feat: message

esc -> :wq

그럼 커밋메시지를 수정할 수 있는 화면나오는데 거기서 또 i 누르고 수정
수정 다 하면 esc -> :wq로 나오고 수정마침

이미 push한 상태라면 강제로 push 필요

git push --force origin [main]
git push --force origin [브랜치이름]

insert 모드에서 esc 안먹히면 여러번 눌러보기

0개의 댓글