본문 바로가기
Q&A2023년 7월 20일1분 읽기

Git stash 사용법

조
조은서
조회 787댓글 1

작업 중에 다른 브랜치로 갈 때 git stash를 쓴다고 하는데, 기본 사용법을 알려주세요.

댓글 1

김김영삼3년 전

git stash 기본 사용법:

# 현재 변경사항 임시 저장
git stash

# 메시지와 함께 저장
git stash push -m "로그인 기능 작업 중"

# 목록 확인
git stash list

# 가장 최근 stash 복원
git stash pop

# 특정 stash 복원
git stash apply stash@{1}

# stash 삭제
git stash drop stash@{0}

# 전체 삭제
git stash clear

작업 중 긴급 핫픽스가 필요할 때: stash → 브랜치 이동 → 수정 → 원래 브랜치 → pop

Ctrl+Enter로 등록