Git
[Git] stash
qoth_0
2023. 12. 18. 09:06
728x90
반응형
git stash
- git stash는 작업 중인 변경사항을 임시로 저장하고 나중에 다시 적용할 수 있게 해주는 명령어
- git stash list
- 작업저장목록
- git stash show 인덱스
- 복사본 내용 조회
- git stash show -p 인덱스 : 상세조회
- git stash pop
- 작업목록에서 제거하면서 저장사항 적용
- git stash apply
- 작업목록에서 놔둔채 저장사항 적용
- git stash apply 0
- 가장 최근에 저장한 stash의 적용
- git stash clear
- 전체 stash 목록 클리어
실습

local에서 수정 후 commit하지 않은 상태

origin에서는 수정 후 커밋

pull하면 error 발생

git stash

했더니 내가 적어놓은 부분이 사라짐 - 따로 저장된것

stash list로 인덱스 0에 저장된 것 확인(가장 최신내용이 0)
stash show -p 0으로 인덱스 0의 stash 상세내용을 확인

stash로 수정사항을 없앴기 때문에 pull 가능

origin의 내용으로 적용됨

git stash pop하면

저장사항이 적용되며 충돌발생

변경, 저장 후 add, commit, push

적용 완료

728x90
반응형