Reading a stash before you use it

Opening one as a working copy you cannot change: its files, its diffs, and the one thing you can still do to it.

A stash can be read, file by file, without being applied. Show Diff on its row in the sidebar — the actions button at the right-hand end of the row, or a right-click — opens it, and so does selecting the row.

That is the answer to the situation everyone with more than two stashes ends up in: four entries, made over three weeks, and no memory of what is in any of them. Restoring one to find out means unpicking the result afterwards — or, if you asked for the stash to be deleted along the way, losing the ability to change your mind.

The stash in place of the working copy: its files in the middle, the diff of the selected one on the right, and nothing underneath the list to commit with.

A working copy you cannot change

What opens is the shape you already know, in the place you already know it. The middle column lists the files the stash holds and the right-hand column shows the diff of the selected one; the heading above the list is the stash’s message, with its stash@{n} reference beside it.

Above the files is All files, which is the whole stash as one diff. The list opens on its first file, and All files stays chosen once you have chosen it rather than dropping back to the first file on the next refresh.

What is not there is everything that would change something. No staging, no commit panel, no Discard, no Blame — and not merely as missing buttons: while a stash is open those commands are unavailable in the menus and in the Command Palette too. A stash is a record of what a working copy was, and nothing on this screen edits it.

The one thing you can still do to it is in the header above the list: Restore Changes, which asks the same question as Restore… on the sidebar row — including whether the stash should be deleted afterwards — and is unavailable while another operation is running.

Listing flat or by folder

The list is the working copy’s, so it has the working copy’s two layouts and the layout menu above it switches between them. In the folder tree, up and down walk every visible row, folders included; left and right — and the disclosure triangle — are what collapse and expand, so moving the selection never opens or closes anything. Collapsing a folder that holds the selected file moves the selection onto the folder.

The flat layout is flat, with none of the working copy’s Changes and Unversioned Files division to group by: everything in a stash is a change the stash holds. The menu says as much — the entry that reads Grouped by Status over the working copy reads Flat file list over a stash.

What a stash turns out to contain

Tracked changes, read from the commit the stash was made on to the tree it saved, with renames and copies followed rather than shown as a delete and an addition.

A stash that captured untracked files shows those too, as additions. Two of the three ways of saving one take them — Stash All Changes… and Stash Selected Files… — and so do the stashes Innesta makes to get files out of the way during a pull.

The numbers move; the stash does not

stash@{n} is a position in a list, and deleting the entry under yours turns stash@{1} into stash@{0}. The review follows the stash itself rather than its number, so the reference in the heading changes and what you are reading does not.

Leaving it

Selecting Working Copy in the sidebar puts your own files back in the column, and so does the changed-file button in the status bar. Choosing any other section does the same.

If the stash you were reading goes away — you deleted it, you restored it with Delete stash after restoring ticked, or something outside the app removed it — the review closes instead of showing you whatever has taken its place.

Larger, and side by side

The Diff Review window opens a stash as well, with the same file list — titled Stash Files, with its own All files row and the same keyboard navigation — and the change shown Side by side rather than inline.

Not only stashes

The backup Innesta keeps of a discard opens in this same review — its files in the middle, the diff on the right, Restore Changes above the list — because it is the same kind of thing: a record of what a working copy held, kept so that it can be put back.