📦 StashingCommonly used

How to stash changes in Git

Temporarily save uncommitted changes so you can switch context.

Stash current changes
git stash

Saves all staged and unstaged changes and reverts to the last commit.

When to use: Quickly save work in progress to switch branches.

Stash with a description
git stash push -m "work in progress on login form"

Stashes changes with a descriptive message for easy identification later.

When to use: When you have multiple stashes — descriptions help you find the right one.

Stash including untracked files
git stash -u

Also stashes new untracked files that haven't been added yet.

Stash specific files
git stash push -m "description" path/to/file.txt

Stashes only the specified file, leaving other changes intact.

← Back to Git Reference