Restoring a stash

Putting the changes back, with the choice of whether the stash survives it.

Two things can be done with a saved stash: put its changes back, or throw it away. Both are on the stash’s own row in the sidebar — the actions button at its right-hand end, or a right-click — alongside Show Diff, as Restore… and Delete…. The first of them is also in the header above the file list when you have opened the stash to read it, where it reads Restore Changes.

The ellipsis on each is not decoration: both ask before they do anything.

The line under the title says which of the two you are about to get, and it is rewritten as the box below it is ticked.

One action, and a checkbox

Restore… opens Restore Stashed Changes, which puts the stash’s changes back into your working copy. Under the sentence that says so is Delete stash after restoring, and that box is the whole of the difference between what used to be two separate commands:

  • left alone, the changes come back and the stash stays in the list;
  • ticked, the changes come back and the stash is deleted.

Either way the changes come back unstaged, whatever they were when the stash was saved.

The sentence above the box is rewritten as you tick it, so what you are about to get is written out before you agree to it. Read that rather than the box.

Only after it worked

Restoring can fail: the file underneath the stash has moved on, and the two disagree. When that happens nothing is deleted whichever way the box was set — the stash is still in the list, and the conflict is in your working copy, for the same three-pane editor as anything else.

That is what the confirmation is promising, and it is the one thing the two old commands could not say between them. What the box does not protect you from is a restore that works and then turns out to be the wrong stash: that one has already taken the stash with it, and nothing in Recovery holds a copy — it keeps backups of discards, resets and deleted branches, and a stash is none of those. When you are not sure what is in a stash, read it before you restore it, or leave the box alone.

The box remembers what you chose

It comes back the way you left it — in this window, and in any other Innesta window open at the same time. The choice is recorded when you restore, not when you tick it: cancelling the sheet leaves the setting where it was.

It starts unticked, which is restore and keep.

The one that restores itself

A stash Innesta made switching away from a branch can be marked to come back on its own when you return to that branch, and then neither of these two actions is yours to take. Taking one anyway cancels the mark: you have dealt with the stash, so Innesta stops planning to.

Restoring onto a different branch

A stash is not tied to the branch it was made on. Restoring it somewhere else is allowed and often useful — it is how you move a change you started in the wrong place. It is also where most conflicts come from, for the reason above.

Deleting one without restoring it

Delete… asks Delete Stash, and removes the stash without touching your working copy. It is the one of the two that Innesta marks destructive, which is the app agreeing with the paragraph above: there is no copy anywhere else.

Either way of losing a stash closes the review with it, if that is where you were: there is no longer a stash to read.