Skip to content

Latest commit

ย 

History

History
69 lines (44 loc) ยท 929 Bytes

File metadata and controls

69 lines (44 loc) ยท 929 Bytes

Git Stash

git stash๋Š” ํ˜„์žฌ ์ž‘์—… ์ค‘์ด๋˜ ๋‚ด์šฉ์„ ์ž ๊น ์น˜์›Œ๋‘๊ณ  ๋‹ค๋ฅธ ์ž‘์—…์„ ํ•ด์•ผ ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.


1. ํ˜„์žฌ ์ž‘์—… ์ž„์‹œ ์ €์žฅ

์ˆ˜์ • ์ค‘์ธ ๋‚ด์šฉ์„ stash์— ์ €์žฅํ•œ๋‹ค.

git stash

2. stash ๋ชฉ๋ก ํ™•์ธ

์ €์žฅ๋œ stash ๋ชฉ๋ก์„ ํ™•์ธํ•œ๋‹ค.

git stash list

example

git stash list
stash@{0}: WIP on main: a1b2c3d update README

3. ์ตœ๊ทผ stash ๋‹ค์‹œ ์ ์šฉ

๊ฐ€์žฅ ์ตœ๊ทผ stash๋ฅผ ์ ์šฉํ•˜๊ณ  stash ๋ชฉ๋ก์—์„œ ์ œ๊ฑฐํ•œ๋‹ค.

git stash pop

4. stash ์ ์šฉ๋งŒ ํ•˜๊ธฐ

์ ์šฉ๋งŒ ํ•˜๊ณ  ๋ชฉ๋ก์—์„œ๋Š” ์ง€์šฐ์ง€ ์•Š๋Š”๋‹ค.

git stash apply

5. stash ์‚ญ์ œ

ํŠน์ • stash๋ฅผ ์‚ญ์ œํ•œ๋‹ค.

git stash drop stash@{0}

6. ์ž์ฃผ ์“ฐ๋Š” ๋ฐฉ์‹

git stash
git switch main
git stash pop