2026-01-24

git commit --amend로 커밋 수정

최근 커밋을 수정하는 amend 옵션의 활용 시나리오를 정리합니다.

Rhio Kim

Rhio Kim

CEO

#git#commit#amend

Page reactions

Leave a quick reaction to this shorts.

반응을 불러오는 중...

!!steps

!duration 180.0

!

_10
# 최근 커밋 메시지 변경
_10
$ git commit --amend -m "Fix typo in API docs"
_10
[main 5d6e7f8] Fix typo in API docs
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
1 file changed, 1 insertion(+), 1 deletion(-)

!!steps

!duration 240.0

!

_10
# 빠진 파일을 이전 커밋에 포함
_10
$ git add missing-file.js
_10
$ git commit --amend --no-edit
_10
[main 8e9f0a1] Update configuration
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
2 files changed, 5 insertions(+)

!!steps

!duration 300.0

!

_10
# 커밋 타임스탬프 변경 방지
_10
$ git commit --amend --date=now
_10
[main a1b2c3d] Refactor module
_10
Date: Tue Apr 11 09:15:00 2023 +0900
_10
3 files changed, 45 insertions(+)

!!steps

!duration 240.0

!

_10
# 커밋 작성자 정보 수정
_10
$ git commit --amend --author="John Doe <john@example.com>"
_10
[main f5g6h7i] Fix security issue
_10
Author: John Doe <john@example.com>
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
1 file changed, 3 deletions(-)

!!steps

!duration 180.0

!

_10
# 빈 변경으로 메시지 수정
_10
$ git commit --amend --allow-empty -m "Update CI config"
_10
[main 9h0i1j2] Update CI config
_10
Date: Mon Apr 10 14:30:00 2023 +0900

Git commit --amend 명령어 사용 시나리오


_10
## !!steps
_10
!duration 180.0
_10
_10
# 최근 커밋 메시지 수정
_10
$ git commit --amend -m "Fix typo in API docs"
_10
[main 5d6e7f8] Fix typo in API docs
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
1 file changed, 1 insertion(+), 1 deletion(-)


_10
## !!steps
_10
!duration 240.0
_10
_10
# 누락된 파일 추가 후 커밋 수정 (메시지 유지)
_10
$ git add missing-file.js
_10
$ git commit --amend --no-edit
_10
[main 8e9f0a1] Update configuration
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
2 files changed, 5 insertions(+)


_10
## !!steps
_10
!duration 300.0
_10
_10
# 커밋 날짜를 현재 시간으로 변경
_10
$ git commit --amend --date=now
_10
[main a1b2c3d] Refactor module
_10
Date: Tue Apr 11 09:15:00 2023 +0900
_10
3 files changed, 45 insertions(+)


_10
## !!steps
_10
!duration 240.0
_10
_10
# 커밋 저자 정보 수정
_10
$ git commit --amend --author="John Doe <john@example.com>"
_10
[main f5g6h7i] Fix security issue
_10
Author: John Doe <john@example.com>
_10
Date: Mon Apr 10 14:30:00 2023 +0900
_10
1 file changed, 3 deletions(-)


_10
## !!steps
_10
!duration 180.0
_10
_10
# 파일 변경 없이 커밋 메시지만 수정
_10
$ git commit --amend --allow-empty -m "Update CI config"
_10
[main 9h0i1j2] Update CI config
_10
Date: Mon Apr 10 14:30:00 2023 +0900