Git Cheat Sheet · Set aside

Resume a stash

git stash pop · git stash apply

git stash pop reapplies the most recent stash and removes it from the list. git stash apply reapplies it while keeping it, which is useful for applying it to several branches or as a precaution.

What it does

Reapplies changes set aside; "pop" also removes them from the reserve.

A use case

The emergency is handled, you return to your branch and pick up where you left off.

On the command line

git stash pop
Reapplies the last stash and deletes it.
git stash apply
Reapplies the last stash and keeps it.
git stash apply stash@{2}
Reapplies a specific stash.
git stash branch <branch>
Creates a branch from the stash's commit and applies the stash to it.

In Merathon

  1. "Pop" button: reapplies the most recent stash and deletes it.
  2. For another one: "Stashes" section of the left panel, right-click → "Apply" or "Apply and delete (pop)".

Frequently asked questions

What happens if git stash pop hits a conflict?

Git applies what it can and marks the conflicts. The stash is then not deleted: resolve the conflicts, then git stash drop.

I deleted a stash by mistake, can I find it again?

Often, yes: git fsck --unreachable | grep commit lists orphan commits, including stashes; git stash apply <hash> reapplies it.

See also