Previous: Resetting, Up: Manipulating [Contents][Index]
Also see the git-stash(1) manpage.
magit-stash
) ¶This transient prefix command binds the following suffix commands along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked.
magit-stash-both
) ¶Create a stash of the index and working tree. Untracked files are
included according to infix arguments. One prefix argument is
equivalent to --include-untracked
while two prefix arguments are
equivalent to --all
.
magit-stash-index
) ¶Create a stash of the index only. Unstaged and untracked changes are not stashed.
magit-stash-worktree
) ¶Create a stash of unstaged changes in the working tree. Untracked
files are included according to infix arguments. One prefix
argument is equivalent to --include-untracked
while two prefix
arguments are equivalent to --all
.
magit-stash-keep-index
) ¶Create a stash of the index and working tree, keeping index intact.
Untracked files are included according to infix arguments. One
prefix argument is equivalent to --include-untracked
while two
prefix arguments are equivalent to --all
.
magit-snapshot-both
) ¶Create a snapshot of the index and working tree. Untracked files
are included according to infix arguments. One prefix argument is
equivalent to --include-untracked
while two prefix arguments are
equivalent to --all
.
magit-snapshot-index
) ¶Create a snapshot of the index only. Unstaged and untracked changes are not stashed.
magit-snapshot-worktree
) ¶Create a snapshot of unstaged changes in the working tree.
Untracked files are included according to infix arguments. One
prefix argument is equivalent to --include-untracked
while two
prefix arguments are equivalent to --all
-.
magit-stash-apply
) ¶Apply a stash to the working tree.
When using a Git release before v2.38.0, simply run git stash apply
or with a prefix argument git stash apply --index
.
When using Git v2.38.0 or later, behave more intelligently:
First try git stash apply --index
, which tries to preserve
the index stored in the stash, if any. This may fail because
applying the stash could result in conflicts and those have to
be stored in the index, making it impossible to also store the
stash’s index there.
If the above failed, then try git stash apply
. This fails
(with or without --index
) if there are any uncommitted
changes to files that are also modified in the stash.
If both of the above failed, then apply using git apply
.
If there are no conflicting files, use --3way
. If there are
conflicting files, then using --3way
requires that those
files are staged first, which may be undesirable, so prompt
the user whether to use --3way
or --reject
.
Customize magit-no-confirm
if you want to always use --3way
,
without being prompted.
magit-stash-pop
) ¶Apply a stash to the working tree. On complete success (if the stash can be applied without any conflicts, and while preserving the stash’s index) then remove the stash from stash list.
When using a Git release before v2.38.0, simply run git stash pop
or with a prefix argument git stash pop --index
.
When using Git v2.38.0 or later, behave more intelligently:
First try git stash pop --index
, which tries to preserve
the index stored in the stash, if any. This may fail because
applying the stash could result in conflicts and those have to
be stored in the index, making it impossible to also store the
stash’s index there.
If the above failed, then try git stash apply
. This fails
(with or without --index
) if there are any uncommitted
changes to files that are also modified in the stash.
If both of the above failed, then apply using git apply
.
If there are no conflicting files, use --3way
. If there are
conflicting files, then using --3way
requires that those
files are staged first, which may be undesirable, so prompt
the user whether to use --3way
or --reject
.
Customize magit-no-confirm
if you want to always use --3way
,
without being prompted.
magit-stash-drop
) ¶Remove a stash from the stash list. When the region is active, offer to drop all contained stashes.
magit-stash-show
) ¶Show all diffs of a stash in a buffer.
magit-stash-branch
) ¶Create and checkout a new branch from an existing stash. The new branch starts at the commit that was current when the stash was created.
magit-stash-branch-here
) ¶Create and checkout a new branch from an existing stash. Use the
current branch or HEAD
as the starting-point of the new branch.
Then apply the stash, dropping it if it applies cleanly.
magit-stash-format-patch
) ¶Create a patch from STASH.
magit-stash-clear
) ¶Remove all stashes saved in REF’s reflog by deleting REF.
magit-stash-list
) ¶List all stashes in a buffer.
This option specifies whether the margin is initially shown in stashes buffers and how it is formatted.
The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)
.
age
(to show the age of the commit), age-abbreviated
(to
abbreviate the time unit to a character), or a string (suitable
for format-time-string
) to show the actual date. Option
magit-log-margin-show-committer-date
controls which date is being
displayed.
Previous: Resetting, Up: Manipulating [Contents][Index]