ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • reset/checkout
    git 2019. 12. 6. 00:00

    1) commit 3의 상태로 돌리고 싶을 때

    git reset + commit ID

    가장 최신 commit이 commit 3으로 변경되었다

    gistory에서도 최신 commit이 3임을 알 수 있다

     

    2) reset을 취소하고싶을 때

    git의 ORIG_HEAD에는 위험한 명령을 수행하기전에 현재 최신 버전의 commit을 저장해두고 수행한다

    git reset --hard ORIG_HEAD

    최신 commit이 다시 4가 되었다

     

    .git\logs\refs\heads\master 에 보면 commit의 log를 확인할 수 있다

    git reflog

    3) commit ID에 checkout할 수 있다

    git checkout + commit ID 

    현재 HEAD는 master가 아닌 commit 3의 commit ID

     

    'git' 카테고리의 다른 글

    원격저장소 만들기  (0) 2019.12.09
    working copy/index/repository  (0) 2019.12.09
    merge/conflict  (0) 2019.12.05
    stash  (0) 2019.12.05
    branch  (0) 2019.12.02

    댓글

Designed by Tistory.