Branches and merging · Lesson 8 of 15
Park work temporarily with stash
Clean the working tree without a fake commit, then restore work.
9 minutes2 games
If an urgent bug arrives mid-feature, git stash push stores tracked and staged changes on a temporary stack and cleans the tree. Return with git stash pop.
Unfinished work
stash push
Urgent task
stash pop
Git
git init -q -b main echo "v1" > app.txt git add app.txt git commit -q -m "Base" echo "draft" >> app.txt git stash push -m "feature draft" git stash list
pop applies the latest stash and removes it on success; apply keeps it. Add a clear message. In real Git, untracked files require -u.
Quick question
Apply a stash but keep it listed?
Exercise
Commit clean, change it to draft, stash it, then print the file.
Expected output: clean
Git
git init -q -b main echo "clean" > app.txt git add app.txt git commit -q -m "Base" echo "draft" > app.txt cat app.txt
Learn more from
Played 0 of 2 games
Sign in to save your progress and earn XP.