aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-stash.txt
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-08-13 14:29:44 +0200
committerJunio C Hamano <gitster@pobox.com>2009-08-15 15:19:31 -0700
commitdda1f2a5c3aca5072aada32eef159067ba16f0e9 (patch)
tree02fc359424824fd005e183044e2bc2a9d14df930 /Documentation/git-stash.txt
parent4f353658b9c15e9188530fac5ae79d0aa1538e85 (diff)
downloadgit-dda1f2a5c3aca5072aada32eef159067ba16f0e9.tar.gz
Implement 'git stash save --patch'
This adds a hunk-based mode to git-stash. You can select hunks from the difference between HEAD and worktree, and git-stash will build a stash that reflects these changes. The index state of the stash is the same as your current index, and we also let --patch imply --keep-index. Note that because the selected hunks are rolled back from the worktree but not the index, the resulting state may appear somewhat confusing if you had also staged these changes. This is not entirely satisfactory, but due to the way stashes are applied, other solutions would require a change to the stash format. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-stash.txt')
-rw-r--r--Documentation/git-stash.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 1c64a02fe5..4b15459c83 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -13,7 +13,7 @@ SYNOPSIS
'git stash' drop [-q|--quiet] [<stash>]
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
'git stash' branch <branchname> [<stash>]
-'git stash' [save [--keep-index] [-q|--quiet] [<message>]]
+'git stash' [save [--patch] [--[no-]keep-index] [-q|--quiet] [<message>]]
'git stash' clear
'git stash' create
@@ -42,7 +42,7 @@ is also possible).
OPTIONS
-------
-save [--keep-index] [-q|--quiet] [<message>]::
+save [--patch] [--[no-]keep-index] [-q|--quiet] [<message>]::
Save your local modifications to a new 'stash', and run `git reset
--hard` to revert them. This is the default action when no
@@ -51,6 +51,16 @@ save [--keep-index] [-q|--quiet] [<message>]::
+
If the `--keep-index` option is used, all changes already added to the
index are left intact.
++
+With `--patch`, you can interactively select hunks from in the diff
+between HEAD and the working tree to be stashed. The stash entry is
+constructed such that its index state is the same as the index state
+of your repository, and its worktree contains only the changes you
+selected interactively. The selected changes are then rolled back
+from your worktree.
++
+The `--patch` option implies `--keep-index`. You can use
+`--no-keep-index` to override this.
list [<options>]::