본문 바로가기
utils/git and github

[Git] commit —amend

by ds31x 2024. 5. 20.

git commit --amend

이미 repository에 올라간 commit을 수정 할 때 이용.

amend : 개정 수정하다

  • 이 경우, editor sw가 실행되어 message를 남김.

Commit을 한 이후,

일부 파일을 stage에 넣는 것을 잊고 commit을 한 것을 뒤늦게 알게 된 경우, --amend를 이용함.

또는 commit message를 수정해야 하는 경우에도 이용됨.


Example

git commit -m 'initial commit'
git add forgotten_file         # 잊었던 파일을 뒤늦게 추가...
git commit --amend

참고로, 수정 대상에 tag가 지정되었던 경우에는
해당 tag는 --amend 가 이루어지기 전 상태를 가르키게 됨.

728x90

'utils > git and github' 카테고리의 다른 글

[Git] git diff  (0) 2024.05.20
[Git] Git Summary (작성중)  (0) 2024.05.20
[Git] commit  (0) 2024.05.20
[Git] git add  (0) 2024.05.20
[Git] git status  (0) 2024.05.20