본문 바로가기
Git

Git :: git stash 임시 저장해두기

by 개발하는 호빗 2022. 4. 29.
작업 도중에 잠시 브랜치를 바꿔야 할 경우 완료하지 않은 일을 commit하기 껄끄러울 때 git stash를 사용한다

git stash

git stash를 명령어를 사용하면 작업한 내역이 보관되고 git staging에서도 사라진다.

다른 브랜치에서 작업을 끝내고 다시 돌아오면 stash해둔 내역을 불러오면 되는데,

불러온 작업들은 git staging에 바로 들어가지 않는다.

stash 해 둔 내역을 불러올 때 -index 옵션을 붙여서 불러와야 불러옴과 동시에 git staging에도 추가할 수 있다.

새로운 stash 생성

git stash
git stash save

stash 목록 확인

git stash list

 

stash 했던 작업 다시 가져오기 (git stagint 추가 없이)

git stash apply

git stash apply [stash이름]

stash 했던 작업 다시 가져오기 (git stagint 추가 상태로)

git stash apply — index

 

 

참고 블로그

[Git] git stash 명령어 사용하기 - Heee's Development Blog

'Git' 카테고리의 다른 글

Git :: Amend Commit  (0) 2023.03.29
Git :: revert commit 특정 커밋 되돌리기  (0) 2022.05.01