Module lessons (4/5)
Context switching cleanly with git stash
Shelve unfinished modifications cleanly to ship an urgent hotfix, then restore your state.
What you'll learn in this lesson
- Shelve unfinished edits safely onto a LIFO stack via
git stash push -m "..."without making throwaway commits. - Inspect saved stashes with
git stash listand distinguishgit stash pop(apply + drop) fromgit stash apply(apply + keep). - Switch contexts smoothly for urgent hotfixes and drop finished stashes cleanly with
git stash drop.
Overview
Midway through refactoring src/version.ts, your phone rings: production needs a 2-line fix in HOTFIX.md on a clean branch immediately. Your edits aren't ready to commit — yet deleting them hurts!
git stash captures dirty Working Tree & Staging Index modifications onto an internal LIFO stash stack (stash@{0}, stash@{1}, ...) and leaves your workspace spotless right away:
Sections covered in this lesson
- 1Shelving Half-Done Work in Seconds
- 2Explore Stash Behavior Inside Undo Matrix
Unlock "Context switching cleanly with git stash" and the full Git & Modern Collaboration curriculum
Shelve unfinished modifications cleanly to ship an urgent hotfix, then restore your state.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.