git stash는 작업중에 갑작스럽게 다른 작업을 진행해야할 때, 작업중인 사항을 잠시 치워두는 방법이다.
git stash
git stash는 파일의 변경 내용을 일시적으로 기록해두는 영역이라고 생각하면 된다.
git stash를 사용하면 현재 적용된 commit이후로 변경된 모든 사항들이 stash 공간으로 이동하게 된다.
git stash
git stash save
git stash pop / git stash apply
- git stash로 저장한 코드를 꺼낼때 사용한다. git stash pop을 사용하면 임시 저장공간에 저장된 파일들이 지워진다.
- git stash apply는 임시 저장공간을 그대로 둔 채로 변경사항을 꺼낸다.
git stash pop
git stash apply
git stash list
git stash를 여러번 사용할 수 도 있다. git staah를 여러번 하게 될 경우 순서대로 변경사항이 쌓이게 된다.
스택처럼 동작하기 때문에 가장 최근에 stash한 것이 인덱스가 0이다.
git stash list를 사용하면 쌓인 stash들의 목록을 확인할 수 있다.
git stash list
stash@{0}: WIP on role-mentor: 4b7bc5a commit 메세지
stash@{1}: WIP on letters: 47f2219 commit 메세지
stash@{2}: WIP on letters: a4a6ba0 commit 메세지
git stash apply stash@{[number]}
git stash drop stash@{[number]}
git stash drop
가장 최신의 stash를 삭제할 수 있다.
git stash drop # 가장 최신 stash 삭제
git stash apply; git stash drop; # stash 복원 및 삭제
git stash pop # stash 복원 및 삭제
git stash는 작업중에 갑작스럽게 다른 작업을 진행해야할 때, 작업중인 사항을 잠시 치워두는 방법이다.
git stash
git stash는 파일의 변경 내용을 일시적으로 기록해두는 영역이라고 생각하면 된다.
git stash를 사용하면 현재 적용된 commit이후로 변경된 모든 사항들이 stash 공간으로 이동하게 된다.
git stash
git stash save
git stash pop / git stash apply
- git stash로 저장한 코드를 꺼낼때 사용한다. git stash pop을 사용하면 임시 저장공간에 저장된 파일들이 지워진다.
- git stash apply는 임시 저장공간을 그대로 둔 채로 변경사항을 꺼낸다.
git stash pop
git stash apply
git stash list
git stash를 여러번 사용할 수 도 있다. git staah를 여러번 하게 될 경우 순서대로 변경사항이 쌓이게 된다.
스택처럼 동작하기 때문에 가장 최근에 stash한 것이 인덱스가 0이다.
git stash list를 사용하면 쌓인 stash들의 목록을 확인할 수 있다.
git stash list
stash@{0}: WIP on role-mentor: 4b7bc5a commit 메세지
stash@{1}: WIP on letters: 47f2219 commit 메세지
stash@{2}: WIP on letters: a4a6ba0 commit 메세지
git stash apply stash@{[number]}
git stash drop stash@{[number]}
git stash drop
가장 최신의 stash를 삭제할 수 있다.
git stash drop # 가장 최신 stash 삭제
git stash apply; git stash drop; # stash 복원 및 삭제
git stash pop # stash 복원 및 삭제