Code

Merge branch 'maint-1.5.4' into maint
[git.git] / Documentation / git-stash.txt
index 17121ade56c317d974d537fa3aa3c2b5f116e502..8dc35d493e81bc0c5515ec279dbe95c464c57469 100644 (file)
@@ -8,8 +8,8 @@ git-stash - Stash the changes in a dirty working directory away
 SYNOPSIS
 --------
 [verse]
-'git-stash' (list | show [<stash>] | apply [<stash>] | clear)
-'git-stash' [save] [message...]
+'git-stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>] | pop [<stash>])
+'git-stash' [save [<message>]]
 
 DESCRIPTION
 -----------
@@ -29,23 +29,24 @@ you create one.
 
 The latest stash you created is stored in `$GIT_DIR/refs/stash`; older
 stashes are found in the reflog of this reference and can be named using
-the usual reflog syntax (e.g. `stash@\{1}` is the most recently
-created stash, `stash@\{2}` is the one before it, `stash@\{2.hours.ago}`
+the usual reflog syntax (e.g. `stash@\{0}` is the most recently
+created stash, `stash@\{1}` is the one before it, `stash@\{2.hours.ago}`
 is also possible).
 
 OPTIONS
 -------
 
-save::
+save [<message>]::
 
        Save your local modifications to a new 'stash', and run `git-reset
        --hard` to revert them.  This is the default action when no
-       subcommand is given.
+       subcommand is given. The <message> part is optional and gives
+       the description along with the stashed state.
 
-list::
+list [<options>]::
 
        List the stashes that you currently have.  Each 'stash' is listed
-       with its name (e.g. `stash@\{0}` is the latest stash, `stash@\{1} is
+       with its name (e.g. `stash@\{0}` is the latest stash, `stash@\{1}` is
        the one before, etc.), the name of the branch that was current when the
        stash was made, and a short description of the commit the stash was
        based on.
@@ -54,16 +55,19 @@ list::
 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 linkgit:git-log[1]
+command to control what is shown and how.
 
 show [<stash>]::
 
-       Show the changes recorded in the stash as a diff between the the
+       Show the changes recorded in the stash as a diff between the
        stashed state and its original parent. When no `<stash>` is given,
        shows the latest one. By default, the command shows the diffstat, but
        it will accept any format known to `git-diff` (e.g., `git-stash show
-       -p stash@\{2}` to view the second most recent stash in patch form).
+       -p stash@\{1}` to view the second most recent stash in patch form).
 
-apply [<stash>]::
+apply [--index] [<stash>]::
 
        Restore the changes recorded in the stash on top of the current
        working tree state.  When no `<stash>` is given, applies the latest
@@ -71,11 +75,27 @@ apply [<stash>]::
 +
 This operation can fail with conflicts; you need to resolve them
 by hand in the working tree.
++
+If the `--index` option is used, then tries to reinstate not only the working
+tree's changes, but also the index's ones. However, this can fail, when you
+have conflicts (which are stored in the index, where you therefore can no
+longer apply the changes as they were originally).
 
 clear::
        Remove all the stashed states. Note that those states will then
        be subject to pruning, and may be difficult or impossible to recover.
 
+drop [<stash>]::
+
+       Remove a single stashed state from the stash list. When no `<stash>`
+       is given, it removes the latest one. i.e. `stash@\{0}`
+
+pop [<stash>]::
+
+       Remove a single stashed state from the stash list and apply on top
+       of the current working tree state. When no `<stash>` is given,
+       `stash@\{0}` is assumed. See also `apply`.
+
 
 DISCUSSION
 ----------
@@ -151,10 +171,10 @@ $ git stash apply
 
 SEE ALSO
 --------
-gitlink:git-checkout[1],
-gitlink:git-commit[1],
-gitlink:git-reflog[1],
-gitlink:git-reset[1]
+linkgit:git-checkout[1],
+linkgit:git-commit[1],
+linkgit:git-reflog[1],
+linkgit:git-reset[1]
 
 AUTHOR
 ------
@@ -162,4 +182,4 @@ Written by Nanako Shiraishi <nanako3@bluebottle.com>
 
 GIT
 ---
-Part of the gitlink:git[7] suite
+Part of the linkgit:git[7] suite