Git's stash is a local safety net, and Visual Studio exposes it in several places: the Git Changes window, the Git Repository window, and sometimes a stray context menu. If a stash seems to have vanished, the usual cause is that it was created under a different repository, branch, or user account than the one you're currently viewing—or that a stash pop partially applied and then dropped the entry. The recovery path depends on which of those happened, so the first job is to confirm whether the stash still exists in the repository's reflog before you touch anything else. The steps below start with read-only checks and move toward reconstruction only when the entry is genuinely gone.
Why a stash can look lost when it isn't
Git stores stashes as commits on a special ref, refs/stash, and keeps a reflog for that ref at .git/logs/refs/stash. Visual Studio's stash list is a view onto that ref for the repository it has open. Several ordinary situations make the list look empty or incomplete even though the data is intact:
Wrong repository. A solution can contain projects from more than one Git repository. Visual Studio shows stashes for the active repository, which may not be the one where you stashed. Switching repositories in the Git Changes window changes the list. Wrong branch context. Stashes are not branch-specific in storage—they're repository-wide—but some workflows and older tooling made it look that way. If you expected a stash to appear only on its original branch, check the full list rather than a filtered view. A drop you didn't notice. Applying a stash with the "pop" behavior removes it after a successful apply. If the apply partially failed, the entry can be dropped while only some changes landed in the working tree. Different machine or user profile. Stashes live inside the local .git directory. They don't travel with a push or a clone, and a different Windows account has a different set of local repositories. A clean or reset that touched the reflog. Aggressive cleanup commands can expire reflog entries, and once the stash reflog entry expires, ordinary recovery gets much harder.
Confirming which of these applies takes a minute and prevents the most common mistake: re-running commands that rewrite state before you've captured what survived.
Prerequisites before you start recovering
Do these first, in order, because each one protects work you still have:
1: Stop editing the affected repository. Close files with unsaved changes in that repo, or save them somewhere outside it. Recovery commands can overwrite working-tree files. 2: Identify the exact repository root. In Visual Studio, open the Git Repository window (Git > Manage Branches, or the Git menu) and note the repository path shown. A solution with multiple repos needs the specific one. 3: Create a safety branch or copy. Before any recovery command, commit or stash your current changes, or copy the entire repository folder (including the hidden .git directory) to a backup location. This is reversible and cheap. 4: Open a terminal at the repository root. Visual Studio's integrated terminal works; so does PowerShell, Command Prompt, or Git Bash. All the checks below are read-only until stated otherwise.
If you're on a company-managed machine, confirm you're allowed to run Git commands directly. Some environments restrict the terminal but still allow the Visual Studio UI operations described later.
Check the stash list from the command line first
The UI can hide entries; the command line won't. Run these from the repository root:
A healthy output looks like stash@{0}: WIP on main: 1a2b3c4 message. If you see your entry, note its index—stash@{0} is the most recent, and the numbers shift as entries are added or dropped. If the list is empty, the stash ref has no entries, and you'll move to reflog recovery.
Then check the stash reflog, which records every time the stash ref moved:
or the equivalent:
Every line here is a commit that was, at some point, the top of the stash stack—including entries you dropped. The hash on the left is the commit you can recover. This is the single most useful command in the whole process, so copy the output into a text file before continuing.
If both commands return nothing, the stash data is very likely gone from this clone. Skip to the section on what to do when the reflog is empty.
Match the stash to the right repository and branch
If git stash list is empty but you're certain you stashed, the repository is probably the wrong one. Check for nested repositories:
Run it from the folder where you were editing. If the path differs from the repository Visual Studio has open, you've found the mismatch. Open that folder's repository in Visual Studio (File > Open > Folder, then use the Git menu), or run git stash list from that path directly.
A second check: git worktree list shows linked worktrees. Stashes belong to the shared repository, so they're visible from any worktree, but the path you're in determines which repo you're querying. If you use worktrees for parallel branches, this is a frequent source of "missing" stashes.
Once you've found the right repository and the stash appears, don't pop it yet. First inspect what it contains.
Inspect a stash before applying it
Applying the wrong stash can create a messy merge. Look first:
That prints the diff against the commit the stash was made on. For a summary of changed files only, use git stash show --stat stash@{0}. If the index is in the way, git stash show -p --index stash@{0} includes staged changes as they were.
For a stash recovered from the reflog by hash rather than by index, the same commands work with the hash:
If the output shows the files you expected, you're ready to apply. If it shows a different branch's work, you've matched the wrong entry—check the reflog timestamps and messages against when you remember stashing. Stash messages default to WIP on : , which is usually enough to identify the branch and the commit you were on.
Restore the stash in Visual Studio
Visual Studio's Git Changes window lists stashes under a collapsible section, typically labeled "Stashes." The exact placement varies by version—in current releases it sits below the changes list, and older versions exposed it through the Git Repository window or a context menu. From there:
1: Open Git > Git Changes (or the Git Changes tool window). 2: Expand the Stashes section, or open Git Repository > Stashes if your layout puts it there. 3: Select the entry and choose Apply to restore the changes and keep the stash, or Pop to restore and remove it. Prefer Apply while you're recovering—it's the reversible choice. 4: If conflicts appear, resolve them in the merge editor as you would any merge conflict, then commit or continue.
Applying keeps the stash entry, so a failed or partial apply doesn't cost you the data. Pop removes the entry only after a successful apply in most implementations, but partial-apply edge cases exist, which is why Apply is safer during recovery.
After applying, verify success by checking that the expected files show as modified in Git Changes and that git stash list still shows the entry if you used Apply. If you used Pop, confirm the entry is gone and the working tree has the changes. If files are missing, don't pop anything else—go back to the reflog.
Recover a dropped stash from the reflog
A dropped stash usually remains reachable through the stash reflog for a while. The default expiry for reflog entries is 90 days for reachable commits and 30 days for unreachable ones, though repository settings and cleanup commands can shorten that. The recovery flow:
1: Run git reflog show refs/stash and find the line for the dropped entry. Copy its hash. 2: Verify the contents with git stash show -p . 3: Re-create a named ref so the commit is protected from garbage collection: or, to restore it as a stash entry you can see in Visual Studio again: The second command moves the stash ref back to that commit, which makes it reappear in git stash list and in Visual Studio's stash list. Use it carefully—it changes what stash@{0} points to. 4: Confirm with git stash list and re-check the working tree.
If git stash apply succeeds but produces conflicts, resolve them and commit. The stash entry stays available because you applied rather than popped.
One subtlety: if you dropped several stashes in sequence, the reflog shows each move of the ref, and the hashes are distinct commits. Apply them oldest-first only if you know the order matters; otherwise restore them one at a time and inspect each diff.
What to do when the reflog is empty
An empty stash reflog means the commits are no longer referenced there. Two remaining avenues exist, and both depend on whether the objects have been garbage-collected:
Search dangling commits. Git keeps unreachable objects until garbage collection prunes them. Run:
Look for unreachable commit lines, then inspect promising ones with git show or git log -1 --stat . Stash commits have a distinctive shape—two or three parents, with the message WIP on ...—so they're recognizable even without the reflog. This is slow on large repositories, and the output can be long, so redirect it to a file and search for "WIP on" or your branch name.
Check other clones or backups. If the repository was cloned elsewhere, or if your machine has file-history or backup snapshots, the .git directory from an older copy may still contain the stash ref and its objects. Copying a .git/logs/refs/stash file and the matching objects into the current repository is possible but fiddly; a simpler route is to open the old copy as a repository and apply the stash from there.
If neither works, the stash is gone. Reconstruct from the files themselves if they still exist somewhere—editor local history, the Recycle Bin, temporary files, or a build output folder—and treat this as the point to stop improvising and involve whoever administers your machine or repository hosting if the lost work mattered.
Stop conditions and when to get help
Recovery is safe up to the point where you start rewriting refs or running garbage collection. Stop and get help from a colleague or your repository administrator if any of these apply:
You're about to run git gc, git prune, or git reflog expire on a repository with unrecovered work. git fsck reports corruption, missing objects, or errors rather than just unreachable commits. The repository is shared and others may be pushing to it; rewriting refs on a shared remote affects everyone. You're on a managed device where terminal access or Git configuration is locked down.
In those cases, a backup copy of the repository folder and a description of what you ran so far is the most useful thing you can hand over.
Preventing the next lost stash
A few habits make stash loss rare:
Use Apply, not Pop, until you've confirmed the changes. Apply keeps the entry; pop removes it. The extra click is cheap insurance. Write descriptive stash messages. git stash push -m "checkout page validation" produces a stash you can identify months later, and Visual Studio shows the message in its list. Commit instead of stashing for anything you'd be upset to lose. A temporary commit on a scratch branch is visible in the branch list, travels with the repository, and is far harder to lose than a stash. Don't rely on stashes surviving machine changes. They live in the local .git folder and don't sync. Moving to a new laptop or a fresh clone leaves them behind. Check the repository before stashing in multi-repo solutions. A stash in the wrong repo is the most common "lost stash" report, and it's a one-second check.
Visual Studio's stash UI has improved over recent versions, but it's still a thin layer over Git's refs. Knowing the three commands—git stash list, git reflog show refs/stash, and git stash apply —covers nearly every recovery case, and doing them in that order keeps you from destroying the data you're trying to save.