Git checkout, reset, revert

박정재·2022년 5월 6일
0

checkout은 head를 움직인다.
Attached 상태일 때, reset은 head가 가리키는 branch를 움직인다.
Detached일 땐, checkout과 똑같다.

reflog를 통해 commit id를 확인하여 reset한 것 복원 가능하다. 또는 git reset --hard HEAD@{} {} 안에 몇 번째 전 버전으로 reset할 것인지 숫자를 넣어주면 된다. HEAD@{}도 reflog로 확인 가능!

reset할 때 local에서 작업한 것만 하는 것이 좋다. 원격 저장소 내용 reset하면 난리 날 수도...

revert는 특정 commit만 취소.

profile
Keep on dreaming and dreaming

0개의 댓글