Stash
Temporarily shelving uncommitted changes to work on something else without losing work in progress.
Also known as: Git Stash, Stashing
Category: Concepts
Tags: software, version-control, git, workflows, productivity
Explanation
Git stash is a command that temporarily saves your uncommitted changes (both staged and unstaged) and reverts your working directory to match the last commit. This creates a clean slate so you can switch branches or work on something else, with the ability to restore your changes later.
Stashing is invaluable when you're in the middle of work and need to context switch. Maybe a critical bug needs immediate attention, or you need to check something on another branch. Rather than committing half-finished work or losing changes, you stash them, handle the interruption, then restore your work.
Stashed changes are kept in a stack—you can stash multiple times and retrieve them in any order. Each stash is labeled with a message, and you can apply stashes to any branch, not just where they originated. You can also create a branch from a stash if your experiment grew into something substantial.
The stash command supports partial stashing (specific files or hunks), keeping staged changes staged when applying, and preserving untracked files. This flexibility makes it a powerful tool for managing work in progress and juggling multiple contexts.
For knowledge work, stashing represents parking incomplete thoughts when you need to context switch. Rather than forcing ideas to completion or abandoning them, you save the partial work, handle the interruption, and return to restore your thinking. It acknowledges that knowledge work often involves multiple concurrent threads and provides a mechanism to manage that complexity without losing progress.
Related Concepts
← Back to all concepts