처음부터 차근차근

reset의 종류 본문

Git

reset의 종류

_soyoung 2021. 10. 29. 16:15
반응형
reset의 종류

 

reset의 종류는 아래와 같다.

 

  • soft
  • mixed
  • hard
  • merge
  • keep
  • [no-]recurse-submodules

git reset --help를 치면 볼 수 있다.

 

여기서 중요하고 자주 사용하는 세가지 종류에 대해서 살펴볼 것이다.

  • soft
  • mixed
  • hard

 

 

 

soft, mixed, hard reset

 

git reset --soft : repository(원격 저장소)에 있는 내용만 reset된다.

git reset --mixed : repository와 index(git add한 내용)에 있는 내용만 reset된다.

git reset --hard : repository와 index, working directory(git add하지 않은 내용들) 모두 reset된다.

 

모드(--hard 같은거)를 생략하면 default 값으로 mixed가 들어간다.

 

 

 

* 용어 정리

working directory == working copy == working tree : git add하지 않은 내용, git add한 내용 모두

index == staging area == cache : git add한 파일

repository == history == tree : 원격저장소, git commit한 내용

 

 

 

+ git diff : working directory의 내용과 index의 내용을 비교하여 출력하는 명령어

윗줄이 index내용,

아랫 줄은 working copy내용이다.

 

 

 

 

 

 

 

출처 : '지옥에서 온 Git - 생활 코딩' 변형 및 요약

반응형

'Git' 카테고리의 다른 글

로컬에서 원격 저장소 만들기  (0) 2021.11.06
merge(branch) 충돌 원리와 3 way merge  (0) 2021.11.04
reset 취소와 commit checkout  (0) 2021.10.28
Branch 충돌  (0) 2021.10.19
branch의 원리와 git log의 원리  (0) 2021.10.01
Comments