gritHEAD → docs/stash
Commands / Making changesMarkdown

grit stash

Save and restore shelved work.

grit stash [-m <msg>] [-u]
grit stash push [-m <msg>] [-u]
grit stash list
grit stash show [<n>] [-p]
grit stash apply [<n>]
grit stash pop [<n>]
grit stash drop [<n>]

Description

Shelve uncommitted changes and restore them later. With no subcommand, grit stash saves local changes (same as grit stash push), resets the working tree and index to HEAD, and records a stash entry compatible with Git's refs/stash format.

Stash indices follow Git: 0 is the newest entry. You can pass an integer or stash@{n}.

grit stash pop applies the entry and removes it when there are no conflicts. When applying would leave merge conflicts, the stash entry is kept and the command exits non-zero; conflicting paths are listed.

Options

Option Description
-m, --message Message stored on the stash reflog (push / bare grit stash).
-u, --include-untracked Include untracked files in the stash.
<n> Stash index for show, apply, pop, or drop (default 0).
-p, --patch Show the full patch in grit stash show instead of a diffstat.
push Save changes explicitly (same flags as bare grit stash).
list List stash entries.
show Show a diffstat or patch for one entry.
apply Apply an entry without removing it.
pop Apply an entry and drop it when clean.
drop Remove an entry without applying it.

JSON output

Pass --json for stable, scripting-friendly output.

grit stash / grit stash push

Field Type Meaning
oid string Full object id of the stash commit (success object only).
message string Reflog message Git would show after the colon (success object only).
stashed boolean Present and false only on the empty-worktree result.

grit stash list

Field Type Meaning
index number Index matching stash@{index}.
oid string Full stash commit id.
message string Reflog message.

grit stash show

With --patch, a patch object with the same shape as grit diff is included instead of stat.

Field Type Meaning
index number Stash index shown.
stat object Diffstat summary (when -p is not set).
patch object Full diff outcome (when -p is set).

grit stash apply / grit stash pop

Pop adds dropped (whether the entry was removed):

Field Type Meaning
index number Stash index targeted.
conflicts boolean Whether merge conflicts remain.
conflict_paths array of strings Paths with unmerged index entries when conflicts is true.
dropped boolean (pop only) Whether the stash entry was removed.

grit stash drop

Field Type Meaning
index number Stash index removed.

Markdown output

With --markdown, list/apply/pop/drop use bullet lists; show renders the diffstat or patch like other diff commands.