git reflog

mohadang·2023년 6월 25일
0

Git

목록 보기
8/16
post-thumbnail

reflog로 commit, rebase, reset등의 작업을 취소할 수 있다.

실수로 .log 추가 커밋을 제거한 상황이다

git reflog 명령어를 사용하여 변경 이력을 확인한 후 .log 추가를 한 이력으로 되돌아 갈 수 있다

commit 복구

  1. git reflog 명령어로 삭제된 commit id 확인
  2. git reset --hard <커밋해시id>

branch 복구

  1. git reflog or git reflog | grep 브랜치명 으로 log확인
  2. git checkout -b <삭제한 브랜치명> <커밋해시id>
profile
mohadang

0개의 댓글