summaryrefslogtreecommitdiff
path: root/Documentation/git-stash.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/git-stash.txt')
-rw-r--r--Documentation/git-stash.txt22
1 files changed, 21 insertions, 1 deletions
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 23ac331295..8f331ee7d4 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -36,12 +36,15 @@ is also possible).
OPTIONS
-------
-save [<message>]::
+save [--keep-index] [<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. The <message> part is optional and gives
the description along with the stashed state.
++
+If the `--keep-index` option is used, all changes already added to the
+index are left intact.
list [<options>]::
@@ -169,6 +172,23 @@ $ git stash apply
... continue hacking ...
----------------------------------------------------------------
+Testing partial commits::
+
+You can use `git stash save --keep-index` when you want to make two or
+more commits out of the changes in the work tree, and you want to test
+each change before committing:
++
+----------------------------------------------------------------
+... hack hack hack ...
+$ git add --patch foo
+$ git stash save --keep-index
+$ build && run tests
+$ git commit -m 'First part'
+$ git stash apply
+$ build && run tests
+$ git commit -a -m 'Second part'
+----------------------------------------------------------------
+
SEE ALSO
--------
linkgit:git-checkout[1],