Arezgitfield notes / engineering
Git workflowsUPDATED OCT 9, 2026

Use Git Stash Without Losing Track of Your Work

Save unfinished Git work with explicit scope, inspect each stash, restore staged intent, and handle conflicts before retiring the saved state.

Arezgit Editorial5 min read
AREZGIT / FIELD NOTEGIT WORKFLOWS
A stash becomes difficult to trust when nobody remembers which branch it came from, whether it includes new files, or which edits were staged. Saving unfinished work should produce an identi
READ / VERIFY / APPLYTECHNICALLY REVIEWED

A stash becomes difficult to trust when nobody remembers which branch it came from, whether it includes new files, or which edits were staged. Saving unfinished work should produce an identifiable recovery point, not another anonymous entry that might contain the fix you need.

Use this workflow for short interruptions in one local repository. The commands use synthetic project paths and Git 2.45.2 syntax, with quoted stash references that work in PowerShell and Bash. For long-lived parallel work, a separate branch or worktree is usually easier to inspect.

Inventory the state you intend to preserve

Before saving anything, inspect tracked and untracked paths:

git status --short --branch
git diff --stat
git diff --cached --stat

Record the current branch and the reason for the interruption. Distinguish tracked modifications, staged content, untracked files, ignored build products, and local configuration. Decide which items actually need preservation. An ignored dependency directory and a new regression test have very different recovery value.

The Git stash manual documents that the ordinary operation saves tracked working-tree and index changes. Adding --include-untracked also captures untracked files; ignored files require a different, broader option. Avoid broadening the scope automatically, particularly when ignored paths may contain private configuration.

A stash is local repository state. It should not be your only copy of irreplaceable work, and it does not become a remote backup when you push a normal branch. For work that must survive machine failure, use an approved backup or an appropriately reviewed branch without adding confidential files.

Save a named and bounded interruption

For a synthetic feature touching two known paths, save only those paths:

git stash push --include-untracked -m "Invoice export before timeout investigation" -- src/export.ts tests/export.test.ts
git status --short --branch
git stash list

Check the resulting status before switching context. Unrelated files should remain visible if you intentionally excluded them. If the original edits are still present, determine whether a path was omitted or the command failed rather than assuming that the save succeeded.

Use a message that explains the task and interruption, not just the date. Several saves called "work in progress" create an identification problem precisely when you need to recover quickly. The message is a navigation aid; the patch itself remains the evidence.

If the work depends on several additional files, either include them explicitly or choose a branch instead. A partial stash can be useful, but it is not automatically a self-contained project state. Document the missing prerequisites before changing branches so that recovery does not depend on memory.

Inspect before applying

On the intended destination branch, confirm that the working directory is ready for restoration and inspect the saved patch:

git status --short --branch
git stash list
git stash show --patch --include-untracked 'stash@{0}'

The numeric position is relative to the current list. Creating another stash changes which entry is stash@{0}. Re-identify the entry by message and content immediately before applying or dropping it. Do not copy a numeric reference into a long-lived recovery note and assume it will still name the same work later.

Prefer applying first when you want a separate opportunity to verify restoration:

git stash apply --index 'stash@{0}'

This attempts to restore the staged distinction as well as file changes while retaining the saved entry. It is useful when partial staging carried review intent. Restoration can fail or conflict if the destination's index and files are incompatible, so inspect the command result and repository state.

Treat a conflict as a merge decision

In a synthetic example, the destination branch changes the export format while the stash adds a field to the old format. Keeping either side wholesale would lose intent. Determine the desired final format, then integrate the saved behavior into that model.

Inspect conflicted paths, compare the destination behavior with the saved patch, and resolve the files deliberately. Run the relevant tests before treating the restoration as complete. If staged intent could not be restored, reconstruct the index from the verified result rather than assuming the old split still applies.

Git documents that a conflicting stash pop retains the saved entry. That retention is a recovery aid, not proof that the working tree is unchanged. A failed restoration may leave partially applied changes or conflict state. Reapplying blindly can make the state harder to interpret.

Do not use a destructive reset as a casual way to restart. Preserve any unique destination edits first and choose a recovery method appropriate to the current state. The guides to merge conflict resolution and restore, reset, and revert help separate those decisions.

Retire only the verified saved state

Before dropping an entry, verify the recovered files, tests, staged patch, and untracked paths. If you created a commit, inspect that commit from a clean checkout when independence matters. Keep the stash while any part of the restoration remains uncertain.

After checking the list again and confirming the exact entry, retire it explicitly:

git stash list
git stash drop 'stash@{0}'

Avoid clearing the entire stash list as routine cleanup. Other entries may belong to unfinished tasks, and deletion removes a convenient reference to their saved objects. If a stash has become long-lived, convert the recovered work into an identifiable branch and handle it through the normal review process.

At the next interruption, repeat the inventory rather than copying the previous save command mechanically. A useful stash has a defined scope, a recognizable purpose, and a verified restoration path. If any of those becomes difficult to maintain, keep the work in a branch or parallel worktree instead.

READER SIGNAL

Was this guide useful?

Your rating helps us prioritize clearer, more practical technical content.

AREZGIT / DESKTOP WORKSPACEFROM FIELD NOTE TO RELEASE

Review diffs, run checks, and prepare the release in Arezgit.

Keep Git review, security scanning, API checks, database inspection, and release preparation together in one local desktop application.

Explore Arezgit