aboutsummaryrefslogtreecommitdiff
path: root/Documentation/git-stash.txt
diff options
context:
space:
mode:
authorEric Raible <raible@gmail.com>2008-07-08 00:40:56 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-08 13:59:08 -0700
commitcaf1899699b2255111a3db335553e31f3718c1c9 (patch)
treecb34743507a334a887fcf30f99e373a7abb46654 /Documentation/git-stash.txt
parent7bedebcaad351108a8f6eab6a031f2be2c06b613 (diff)
downloadgit-caf1899699b2255111a3db335553e31f3718c1c9.tar.gz
git-caf1899699b2255111a3db335553e31f3718c1c9.tar.xz
Documentation: tweak use case in "git stash save --keep-index"
The documentation suggests using "git stash apply" in the --keep-index workflow even though doing so will lead to clutter in the stash. And given that the changes are about to be committed anyway "git stash pop" is more sensible. Additionally the text preceeding the example claims that it works for "two or more commits", but the example itself is really tailored for just two. Expanding it just a little makes it clear how the procedure generalizes to N commits. Finally the example is annotated with some commentary to explain things on a line-by-line basis.
Diffstat (limited to 'Documentation/git-stash.txt')
-rw-r--r--Documentation/git-stash.txt15
1 files changed, 8 insertions, 7 deletions
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 8f331ee7d..e2c872237 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -180,13 +180,14 @@ 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'
+$ git add --patch foo # add just first part to the index
+$ git stash save --keep-index # save all other changes to the stash
+$ edit/build/test first part
+$ git commit foo -m 'First part' # commit fully tested change
+$ git stash pop # prepare to work on all other changes
+... repeat above five steps until one commit remains ...
+$ edit/build/test remaining parts
+$ git commit foo -m 'Remaining parts'
----------------------------------------------------------------
SEE ALSO