Stashing Work in Progress
Learn how git stash lets you shelve uncommitted changes so you can switch context quickly and restore your work later.
Stashing Work in Progress is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Interruption Problem
You are mid-change when an urgent fix is needed on another branch, but your work is not ready to commit. git stash shelves your changes so you can switch cleanly.
What Is the Stash?
The stash is a stack where Git stores your uncommitted changes (both staged and unstaged) and reverts your working directory to a clean state.
Stashing Your Changes
Running git stash saves your changes and cleans the working tree.
git stash
# Saved working directory and index state WIP on mainNaming a Stash
Give a stash a message so you remember what it holds.
git stash push -m 'half-done login form'Listing Stashes
Stashes are numbered on a stack. List them to see what you have shelved.
git stash list
# stash@{0}: On main: half-done login form
# stash@{1}: WIP on main: 9a3f1c some earlier workRestoring with pop
git stash pop reapplies the most recent stash and removes it from the stack.
git stash pop
# changes are back; stash@{0} is removedapply vs pop
git stash apply reapplies changes but keeps the stash, useful if you want to apply the same work to multiple branches.
git stash apply stash@{1}
# the stash stays in the listIncluding Untracked Files
By default the stash ignores untracked files. Use -u to include them.
git stash push -u -m 'includes new files'Inspecting a Stash
Preview what a stash contains before applying it.
git stash show -p stash@{0}Cleaning Up
Drop a single stash you no longer need, or clear them all.
git stash drop stash@{1}
git stash clearWhen to Use Stash
- Switch branches quickly without committing half-work
- Pull updates onto a dirty working tree
- Experiment, then discard with a drop if it did not pan out
Quick Check
Test your stash knowledge.
Recap
You learned that git stash shelves uncommitted work on a stack so you can switch context cleanly. Use push -m to name stashes, list to view them, pop vs apply to restore, -u for untracked files, and drop/clear to clean up.
Frequently asked questions
Is the “Stashing Work in Progress” lesson free?
Yes — the full text of “Stashing Work in Progress” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.
What will I learn in “Stashing Work in Progress”?
Learn how git stash lets you shelve uncommitted changes so you can switch context quickly and restore your work later. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Stashing Work in Progress” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Staging, Committing, History
- Undoing Changes Locally
- Branching & Merging Basics
- Stashing Work in Progress