📦 StashingCommonly used

How to apply a stash in Git

Restore stashed changes back to your working directory.

Apply most recent stash (keep it)
git stash apply

Applies the most recent stash but keeps it in the stash list.

When to use: When you want to apply the stash to multiple branches.

Pop most recent stash (remove it)
git stash pop

Applies the most recent stash and removes it from the stash list.

When to use: Most common — apply and clean up in one step.

Apply a specific stash
git stash apply stash@{2}

Applies a specific stash by index. Use git stash list to see indexes.

Apply stash to a different branch
git switch other-branch
git stash pop

Switch to another branch first, then apply the stash.

When to use: When you stashed on the wrong branch.

← Back to Git Reference