0Pricing
Git Advanced: Monorepo, Submodules & Workflows · 강의

변경 사항 임시 저장 및 체리픽

변경 사항을 임시로 저장하는 `git stash`와 특정 커밋을 브랜치에 적용하는 `git cherry-pick`을 익힙니다.

변경 사항 임시 저장 및 체리픽은(는) CoddyKit의 무료 Git Advanced: Monorepo, Submodules & Workflows 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Git Advanced: Monorepo, Submodules & Workflows 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Use Git Stash?

Mid-feature and an urgent bug fix lands? git stash temporarily shelves your uncommitted changes so you can switch branches without committing half-done work.

Saving Your Changes Temporarily

Run git stash to save your modified and staged changes, then Git resets your working directory to a clean HEAD. Your work is safely tucked away.

git status
# On branch feature-x
# Changes to be committed:
#   new file:   new_feature.txt
# Changes not staged for commit:
#   modified:   index.html

git stash
# Saved working directory and index state WIP on feature-x: ...
# HEAD is now at ...

git status
# On branch feature-x
# nothing to commit, working tree clean

Viewing Your Stash Stack

You can hold multiple stashes. git stash list shows them all, each indexed — stash@{0} being the most recent.

git stash list
# stash@{0}: WIP on feature-x: ...
# stash@{1}: WIP on bugfix-branch: ...

Bringing Stash Back: Apply

git stash apply restores your most recent stash into the working directory. Want an older one? Name it, like git stash apply stash@{1}.

git checkout bugfix-branch
git stash apply stash@{1}
# On branch bugfix-branch
# Changes not staged for commit:
#   modified:   bug.js

Apply vs. Pop: What's the Difference?

apply vs pop: apply restores changes but keeps the stash in the list; pop restores them and removes the stash. Use pop when you're done with it.

git stash list
# stash@{0}: WIP on feature-x: ...

git stash pop
# On branch feature-x
# Changes not staged for commit:
#   modified:   index.html
# Dropped stash stash@{0} (...

git stash list
# (empty output, stash is gone)

Cleaning Up Stashes

Clean up stashes you no longer need: git stash drop <id> removes one, git stash clear removes all. Clear can't be undone, so be careful.

git stash list
# stash@{0}: WIP on feature-x: ...
# stash@{1}: WIP on old-bug: ...

git stash drop stash@{1}
# Dropped stash stash@{1} (...

git stash list
# stash@{0}: WIP on feature-x: ...

Introducing Git Cherry-Pick

Need just one commit from another branch, not its whole history? git cherry-pick applies a single commit's changes onto your current branch.

Applying a Single Commit

Find the commit hash with git log --oneline, switch to your target branch, then git cherry-pick <hash> to bring just that change over.

git log --oneline
# a1b2c3d Fix: Critical typo in header
# e4f5g6h Feat: Add user profiles

git checkout main
# Switched to branch 'main'

git cherry-pick a1b2c3d
# [main] Fix: Critical typo in header
#  1 file changed, 1 insertion(+), 1 deletion(-)

Resolving Cherry-Pick Conflicts

Cherry-picking can conflict like a merge. Resolve manually, git add the files, then git cherry-pick --continue — or --abort to cancel.

git cherry-pick a1b2c3d
# Auto-merging header.js
# CONFLICT (content): Merge conflict in header.js
# error: could not apply a1b2c3d...

# (Resolve conflicts, then:)
git add header.js
git cherry-pick --continue

Stash & Cherry-Pick Quiz

You are on the feature-A branch, with uncommitted changes. An urgent fix needs to go into main. You stash your changes, switch to main, and fix the bug with a commit (hash: 789abc). Now you want to apply this fix to feature-A and return to your work.

Lesson Summary

Recap: git stash shelves uncommitted work so you can switch branches cleanly, and git cherry-pick grabs a single commit from one branch onto another.

자주 묻는 질문

“변경 사항 임시 저장 및 체리픽” 강의는 무료인가요?

네 — “변경 사항 임시 저장 및 체리픽” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Git Advanced: Monorepo, Submodules & Workflows 강의 전체를 잠금 해제할 수 있습니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

“변경 사항 임시 저장 및 체리픽”에서 뭘 배우나요?

변경 사항을 임시로 저장하는 `git stash`와 특정 커밋을 브랜치에 적용하는 `git cherry-pick`을 익힙니다. 브라우저에서 직접 실행하는 실습 코드로 Git Advanced: Monorepo, Submodules & Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Git Advanced: Monorepo, Submodules & Workflows을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Git Advanced: Monorepo, Submodules & Workflows은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“변경 사항 임시 저장 및 체리픽” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Git Advanced: Monorepo, Submodules & Workflows 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Git Advanced: Monorepo, Submodules & Workflows 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 대화형 리베이스 및 커밋 수정
  2. 변경 사항 임시 저장 및 체리픽
  3. 복구를 위한 reflog
  4. Bisect: 잘못된 커밋 추적
← Git Advanced: Monorepo, Submodules & Workflows(으)로 돌아가기