Undo
Stash
15 min read
A stash keeps uncommitted changes in a separate list, so you can switch to something else and come back to them later: handle an urgent bug on another branch, test something with a clean working directory, get an experiment that isn't ready for a commit out of the way.
In Versora, stash goes beyond basic git stash:
- a title and a multi-line description, to remember later what was half done;
- a choice of what to save: all changes, only the staged changes, a file, a hunk, a few lines, or a snapshot, which keeps a copy without taking anything out of the working directory;
- Apply part…: only some files, hunks or lines of a stash, even with the file already changed;
- Export as patch, including the untracked files.
Stashes show up in the STASHES section of the left panel and as rows in the graph. Click a stash to see its changes in the right panel. The stash's menu (right-click in the section or on the graph row) has all the actions on this page.
- Toolbar: Stash ("Stash the current changes"). It's disabled when there are no changes.
- Left panel › STASHES section: the + ("Stash changes…").
- The graph's WIP row menu: Stash changes….
- Palette (Ctrl+P): "Stash changes…". With no changes, it shows up as unavailable: "there are no changes to stash".
- Click Stash. The Stash changes dialog opens, with the note "Files ignored by .gitignore aren't included. To stash just one hunk or a few lines, use the Stash button in the file's diff."
- Write the Title (optional; "without a title it's "WIP on <branch>"") and, if you want, the Description, over several lines: what's missing, why you stopped.
- Under What to save, choose (table below).
- Click Stash. The stash shows up at the top of the STASHES section.
| Option | What it does | Default |
|---|---|---|
| Title | The line that shows up in the stash list. | Empty ("WIP on main") |
| Description | Multi-line text, kept in the stash's message and shown in its details. | Empty |
| What to save › All changes (including new files) | The usual stash: everything leaves the working directory and the staging area and goes into the stash, including untracked files. | Selected |
| What to save › Only the staged changes (2 files) | Only what is staged goes into the stash; the rest stays. It shows up when something is staged. See "Stash only the staged changes", below. | — |
| What to save › Snapshot: save a copy without removing anything from the working directory | Saves everything in a stash and leaves the files as they are. See "Snapshot", below. | — |
git stash push --include-untracked -m "Login fix, half done
Email validation is still missing."
Git keeps the whole message in the stash commit, but the list (git stash list) would join the
lines into one. With a description, the app rewrites the list entry with just the title:
git stash drop -q stash@{0}
git stash store -m "On main: Login fix, half done" <stash-sha>
Ctrl+Z ("Stash") brings the changes back to the working directory and takes
the stash off the list (git stash pop --index).
- "The stash was created, but its title couldn't be set in the list: …. The content is in commit
a1b2c3d.": the stash exists; if it disappeared from the list, put it back with
git stash store -m "Title" a1b2c3d.
A snapshot keeps the work in progress (the staged changes, the unstaged ones and the new files) in a stash without taking anything out of the working directory. You keep working as if nothing happened, and the stash stays as a picture of that moment to go back to later.
Don't confuse it with a named point: a snapshot keeps only the uncommitted changes, in an entry of the stash list; a point keeps the whole state of the repository (branches, tags, HEAD) and stays out of the list.
- The Stash changes dialog › What to save › Snapshot: save a copy without removing anything from the working directory.
- The graph's WIP row menu: Snapshot (save without removing anything)….
- Palette: "Snapshot of the changes" ("Saves the work in a stash without removing it from the working directory").
- Open the snapshot from the WIP row menu or the palette. The Snapshot dialog explains: "Saves a copy of the work in progress in a stash (staged changes, other changes and new files) without removing anything from the working directory. To get back to it later, apply the stash."
- The Title comes filled in with the date, like "Snapshot 26/11/2026 14:30". Change it if you want and write a Description.
- Click Save snapshot. The indicator shows "Saving snapshot…" and the notice confirms "Snapshot saved in the stash list. Nothing changed in the working directory."
The app builds the same commits git stash builds (parent 1 is HEAD, parent 2 is the staging area,
parent 3 is the untracked files) in a temporary index, without touching your staging area, and
records the result in the list:
git stash store -m "On main: Snapshot 26/11/2026 14:30" <built-commit>
git stash create would do something similar, but would leave out the untracked files.
Ctrl+Z ("Snapshot") takes the snapshot off the list. The files don't change (they never left the working directory).
- "There are no changes to save." (or "There are no changes to save in a snapshot."): the working directory is clean.
- "There are conflicted files. Resolve the conflict before stashing."
- "The repository has no commits yet: a stash needs a commit to start from."
- To go back to a snapshot with the files already changed again, Apply stash may be refused by git. Use Apply part…, which works with the changed file and shows first whether it applies directly or with 3-way.
Keeps only what is staged in a stash. The unstaged changes and the new files stay in the working directory. It's a practical way to choose exactly what to save: stage the files, hunks or lines and stash just that.
- The Stash changes dialog › What to save › Only the staged changes (N files).
- The graph's WIP row menu: Stash only the staged changes… (disabled when nothing is staged).
- Palette: "Stash only the staged changes".
- Stage what goes into the stash (see Staging).
- Open Stash only the staged changes: "Only the staged changes go into the stash (2 files). Unstaged changes and new files stay in the working directory."
- Write the title and the description, if you want, and click Stash.
- The indicator shows "Stashing the staged changes…" and the notice confirms "Stashed the staged changes (2 files)."
git stash push --staged -m "Title"
Ctrl+Z ("Stash of the staged changes") takes the stash off the list and puts the files back as they were, from the copy made beforehand.
- "There's nothing staged." / "There's nothing staged to stash."
- "Stashing only the staged changes needs Git 2.35 or newer (this is 2.34.1).": update git.
- "There are conflicted files. Resolve the conflict before stashing."
- The menu of an unstaged file (right-click in the changes panel): Stash this file….
- Right-click the file and choose Stash this file….
- The Stash this file dialog says: "Only the changes in "src/app.ts" go to the stash; everything else stays as it is."
- Fill in Stash title (optional) (example in the field: "E.g.: Login fix, half done") and Description (optional) ("Details over several lines: what's missing, why you stopped…").
- Click Stash.
git stash push --include-untracked -m "Title" -- src/app.ts
For a renamed file, the stash takes both the old and the new path.
Ctrl+Z ("Stash") brings the file's changes back.
Keeps only one hunk or only the chosen lines of a file in a stash. The rest of the file stays in the working directory, as it was.
- The diff of an unstaged file: the Stash button in each hunk's header ("Stash only this hunk (the rest of the file stays in the working directory)").
- The diff of an unstaged file, with lines chosen (click the line numbers; Shift+click takes a range): Stash lines on the selection bar, next to Stage lines and Discard lines.
- Open the file's diff (unstaged).
- Click Stash on the hunk, or choose the lines and click Stash lines.
- The Stash part of the file dialog confirms what goes: "Going into a stash: the chosen hunk of src/app.ts. The rest of the file stays in the working directory." (or "3 chosen lines").
- Write the title and the description, if you want, and click Stash.
- The indicator shows "Stashing the lines…" and the notice confirms "Stashed. The rest of src/app.ts stays in the working directory."
The app builds the stash in a temporary index (your staging area isn't touched), records it in the list and takes the passage out of the working directory:
git apply --check --reverse - # checks that the passage is still in the file
git apply --cached - # in the temporary index: the stash's version
git stash store -m "On main: Title" <built-commit>
git apply --reverse - # takes the passage out of the file in the working directory
If the file had staged changes, they show up in the stash too (and stay staged), as with
git stash, which keeps the index along with it.
Ctrl+Z ("Stash of lines of src/app.ts") takes the stash off the list and puts the file back as it was.
- The hunk's Stash button doesn't show up in the whole-file view: there, use the line selection.
- With Ignore whitespace on, the hunk's Stash button is disabled ("Unavailable while "Ignore whitespace" is on: the diff without whitespace doesn't match the real file and can't be applied back safely.") and Stash lines doesn't show up.
- "src/app.ts changed since the diff was opened, and the selected lines no longer match. Refresh (F5) and select them again."
- "src/novo.ts isn't in the index: to stash a new file, stash the whole file."
- "No changes selected."
- "The stash was undone because the lines couldn't be removed from src/app.ts: …": nothing changed.
- "There are conflicted files. Resolve the conflict before stashing."
Applies all the stash's changes to the working directory. The stash stays in the list.
- The stash's menu: Apply stash.
- Right-click the stash (in the STASHES section or on the graph row) and choose Apply stash. The indicator shows "Applying stash…".
- If the changes conflict with the ones in the working directory, the files show up in the Conflicted section, and a notice says which ones. Resolve them in the conflict editor; there's no operation to continue.
Before applying, the app asks git which paths the stash touches, to keep the undo copy: those of the saved working directory, those of the saved staging area and the untracked ones (the stash's third parent, when it has one).
git diff --name-only --no-renames -z stash@{1}^1 stash@{1} # what the stash changed in the files
git diff --name-only --no-renames -z stash@{1}^1 stash@{1}^2 # what it kept in the staging area
git ls-tree -r -z --name-only stash@{1}^3 # the untracked files it brought
git stash apply stash@{1}
Ctrl+Z ("Apply stash") undoes the application:
- the files the stash changed go back to how they were before, including their staging;
- the files the stash created (the new ones in the staging area and the untracked ones) are deleted;
- the stash stays in the list, as after any Apply stash.
An application that ran into a conflict also goes into undo: Ctrl+Z removes the markers and the conflict from the staging area and puts the files back as they were before applying.
If you edited one of those files again after applying, undo refuses ("The files were changed again after this operation. Undoing now would overwrite those changes."), instead of deleting or overwriting what's new. See Undo and redo.
- Git refuses to apply when the stash touches a file you changed that would be overwritten. Commit or stash first, or use Apply part….
Applies the stash and takes it off the list.
- The stash's menu: Apply and remove (pop).
- Toolbar: Pop ("Pop the latest stash (apply and drop)"), for the stash at the top of the list.
- Palette: "Pop the latest stash". With no stash, it shows up as unavailable: "there is no stash".
- Choose Apply and remove (pop) in the stash's menu, or click Pop on the toolbar.
- The indicator shows "Popping stash…".
git stash pop stash@{0}
Pop doesn't go into Ctrl+Z: it mixes the stash with your files, and there's no safe way to separate them again. If you're not sure, prefer Apply stash, which goes into Ctrl+Z, and delete the stash afterwards (deleting also goes in).
- "There's no stash to apply.": the list is empty.
- If the pop runs into a conflict, git applies what it could and keeps the stash in the list. Resolve the conflicts and delete the stash afterwards.
- The stash's menu: Edit stash message….
- In the Edit stash message dialog ("The stashed content doesn't change. The stash becomes the most recent one in the list."), change the Message.
- Click Save message. The indicator shows "Editing stash message…".
The app keeps the "On main:" prefix git puts in the messages and rewrites the entry:
git stash drop -q stash@{2}
git stash store -m "On main: New message" <stash-sha>
It doesn't go into Ctrl+Z. Edit the message again.
- "The stash list has changed; refresh and try again.": another stash came in or went out since you opened the menu.
- "The stash was removed from the list but couldn't be stored again (…). Recover it with: git stash store a1b2c3d": run the command shown in the terminal.
- The stash's menu: Delete stash… (in red, at the end of the menu).
- Choose Delete stash…. The Delete stash dialog asks: "Delete "On main: Login fix"? The stashed changes will be lost. You can undo it right after (Ctrl+Z)."
- Confirm Delete. The indicator shows "Deleting stash…".
git stash drop stash@{1}
Ctrl+Z ("Delete stash") puts the stash back in the list (git stash store).
After closing the app, see How to recover lost work.
Applies only the files, hunks or lines you choose. Before changing anything, the window says
whether the passage applies directly, only with 3-way or doesn't apply. It works even with the file
already changed, where git stash apply refuses. The stash stays in the list.
- The stash's menu: Apply part….
- Choose Apply part…. Apply part of the stash opens: "Choose whole files, hunks or lines from "On main: Login fix". The stash stays in the list."
- On the left, Files in the stash, with the tracked and untracked files the stash kept. Check a file's box to apply all of it ("Apply all of src/app.ts").
- To choose only part of it, click the file and, under Changes in the file, click the hunks and the lines (Shift+click picks a range).
- Read the check, which changes with each choice ("Checking…"):
- "Applies without conflicts to the files as they are now.";
- "Doesn't apply directly: applies with a 3-way merge. The result is staged, and conflicts are left for the conflict editor.";
- "Doesn't apply to the files as they are now."
- Click Apply (or Apply with 3-way), or press Ctrl+Enter.
- The notice confirms "Applied (2 files). The stash stays in the list." or, with 3-way and a conflict, "Applied with 3-way: 1 file has conflicts." Close it with Esc.
git diff --no-renames --full-index --binary stash@{1}^1 stash@{1} -- src/validacao.ts # each file's diff
git apply --check - # does it apply directly?
git apply --check --3way - # if not, does it apply with 3-way?
git apply - # directly: nothing goes into the staging area
git apply --3way - # with 3-way: the result is staged
For the stash's untracked files, the diff is against an empty tree (the stash's third parent).
Ctrl+Z ("Apply part of a stash") puts the files that already existed back as they were and deletes the ones the application created (the stash's new and untracked files), even when it only created files. If you edited one of those files again afterwards, undo refuses instead of overwriting it.
- "Choose what to apply: check files, or click hunks and lines (Shift+click picks a range)."
- "Binary file: it can only be applied whole (check it in the list)."
- "File too large to pick lines from: it can only be applied whole (check it in the list)." and "The diff of src/dados.json is too large to show.": the diff goes over 4 MB.
- "The selected changes don't apply to the files as they are now: …".
Copies or saves the whole stash as a patch, including the untracked files it kept, in a format that
git apply (and the app's Apply patch) accepts. It's for handing the work to someone else or
moving it to another machine without a commit.
- The stash's menu: Export as patch › Copy the patch or Save to file….
- To copy: Export as patch › Copy the patch. The "Stash patch copied" notice confirms it.
- To save: Export as patch › Save to file…. The Save the stash as a patch window
suggests a name based on the stash's message (such as
Login-fix.patch), with the.patchand.difftypes. The "Patch saved to C:\…\Login-fix.patch" notice confirms it.
git stash show -p --binary --include-untracked <stash-sha>
stash show's --include-untracked exists since git 2.32. Files in legacy encodings
(Windows-1252) go back to their original bytes when saved.
- "The stash has no changes to export."
- "This git can't export the stash's untracked files (needs 2.32): the patch was made without them."
- "The stash list changed since the menu was opened. Refresh and try again."
Pull, Sync and checkout can put your changes in a stash first and give them back at the end. That's explained in Autostash.