git stash save <message>
This command is useful for temporarily setting aside your current uncommitted changes so you can work on something else without losing your progress, and it lets you label the stash with a custom message for easy identification.
It works by saving both staged and unstaged changes to a new stash entry, which you can later reapply or inspect as needed.
You can use git stash save "WIP: bugfix"
to add a descriptive label, or just git stash
to save changes without a message; note that git stash save
is considered deprecated in favor of git stash push -m <message>
, which offers the same functionality with a more modern syntax.
Other related commands include git stash list
to view all stashes, git stash pop
to reapply and remove the latest stash, and git stash apply
to reapply a stash without removing it from the stash list.
Example:
git stash save "improved navigation"