Home Explore Blog CI



git

2nd chunk of `Documentation/git-stash.adoc`
86f6356b772f96bd1f9f6ec7f12c9f9f5bf70e5eae8f9f8c0000000100000fa4
 favour of 'git stash push'.  It
	differs from "stash push" in that it cannot take pathspec.
	Instead, all non-option arguments are concatenated to form the stash
	message.

list [<log-options>]::

	List the stash entries that you currently have.  Each 'stash entry' is
	listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is
	the one before, etc.), the name of the branch that was current when the
	entry was made, and a short description of the commit the entry was
	based on.
+
----------------------------------------------------------------
stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
stash@{1}: On master: 9cc0589... Add git-stash
----------------------------------------------------------------
+
The command takes options applicable to the 'git log'
command to control what is shown and how. See linkgit:git-log[1].

show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]::

	Show the changes recorded in the stash entry as a diff between the
	stashed contents and the commit back when the stash entry was first
	created.
	By default, the command shows the diffstat, but it will accept any
	format known to 'git diff' (e.g., `git stash show -p stash@{1}`
	to view the second most recent entry in patch form).
	If no `<diff-option>` is provided, the default behavior will be given
	by the `stash.showStat`, and `stash.showPatch` config variables. You
	can also use `stash.showIncludeUntracked` to set whether
	`--include-untracked` is enabled by default.

pop [--index] [-q|--quiet] [<stash>]::

	Remove a single stashed state from the stash list and apply it
	on top of the current working tree state, i.e., do the inverse
	operation of `git stash push`. The working directory must
	match the index.
+
Applying the state can fail with conflicts; in this case, it is not
removed from the stash list. You need to resolve the conflicts by hand
and call `git stash drop` manually afterwards.

apply [--index] [-q|--quiet] [<stash>]::

	Like `pop`, but do not remove the state from the stash list. Unlike `pop`,
	`<stash>` may be any commit that looks like a commit created by
	`stash push` or `stash create`.

branch <branchname> [<stash>]::

	Creates and checks out a new branch named `<branchname>` starting from
	the commit at which the `<stash>` was originally created, applies the
	changes recorded in `<stash>` to the new working tree and index.
	If that succeeds, and `<stash>` is a reference of the form
	`stash@{<revision>}`, it then drops the `<stash>`.
+
This is useful if the branch on which you ran `git stash push` has
changed enough that `git stash apply` fails due to conflicts. Since
the stash entry is applied on top of the commit that was HEAD at the
time `git stash` was run, it restores the originally stashed state
with no conflicts.

clear::
	Remove all the stash entries. Note that those entries will then
	be subject to pruning, and may be impossible to recover (see
	'Examples' below for a possible strategy).

drop [-q|--quiet] [<stash>]::

	Remove a single stash entry from the list of stash entries.

create::

	Create a stash entry (which is a regular commit object) and
	return its object name, without storing it anywhere in the ref
	namespace.
	This is intended to be useful for scripts.  It is probably not
	the command you want to use; see "push" above.

store::

	Store a given stash created via 'git stash create' (which is a
	dangling merge commit) in the stash ref, updating the stash
	reflog.  This is intended to be useful for scripts.  It is
	probably not the command you want to use; see "push" above.

OPTIONS
-------
-a::
--all::
	This option is only valid for `push` and `save` commands.
+
All ignored and untracked files are also stashed and then cleaned
up with `git clean`.

-u::
--include-untracked::
--no-include-untracked::
	When used with the `push` and `save` commands,
	all untracked files are also stashed and then cleaned up with
	`git clean`.
+
When used with the `show` command,

Title: Git Stash Commands and Options
Summary
The git stash command has various options and sub-commands, including push, save, list, show, pop, apply, branch, clear, drop, create, and store, which allow users to manage stash entries, including saving, listing, applying, and removing them. The command also accepts several options, such as --all, --include-untracked, and --no-include-untracked, to control the behavior of stash operations, including the treatment of untracked and ignored files.