2개의 커밋을 취소할 것임
$ git reset --hard HEAD~~
HEAD is now at 326fc9f append description of the add command
$ git log
commit 326fc9f70d022afdd31b0072dbbae003783d77ed
Author: yourname <yourname@yourmail.com>
Date: Mon Jul 16 23:17:56 2022 +0900
append description of the add command
commit 48eec1ddf73a7fb508ef664efd6b3d873631742f
Author: yourname <yourname@yourmail.com>
Date: Mon Jul 16 23:16:14 2022 +0900
first commit
ORIG_HEAD
는 재설정이 발생하기 전의 원래 HEAD 커밋을 가리킴
따라서 ORIG_HEAD
로 reset을 실행하면 이전 기록을 복원 가능
$ git reset --hard ORIG_HEAD
HEAD is now at 0d4a808 append description of the pull command
마지막 커밋을 실행 취소할 것임
$ git revert HEAD
[main d47bb1d] Revert "append description of the pull command"
1 files changed, 1 insertions(+), 2 deletions(-)
$ git log
commit 7bcf5e3b6fc47e875ec226ce2b13a53df73cf626
Author: yourname <yourname@yourmail.com>
Date: Wed Jul 18 15:46:28 2022 +0900
Revert "append description of the pull command"
This reverts commit 0d4a808c26908cd5fe4b6294a00150342d1a58be.
commit 0d4a808c26908cd5fe4b6294a00150342d1a58be
Author: yourname <yourname@yourmail.com>
Date: Mon Jul 16 23:19:26 2022 +0900
append description of the pull command
(생략)
Reset은 과거의 상태로 완전히 돌아가고
Revert는 과거의 상태를 재현한 revert commit을 추가함