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.
This commit is contained in:
Eric Raible 2008-07-08 00:40:56 -07:00 committed by Junio C Hamano
parent 7bedebcaad
commit caf1899699

View File

@ -180,13 +180,14 @@ each change before committing:
+ +
---------------------------------------------------------------- ----------------------------------------------------------------
... hack hack hack ... ... hack hack hack ...
$ git add --patch foo $ git add --patch foo # add just first part to the index
$ git stash save --keep-index $ git stash save --keep-index # save all other changes to the stash
$ build && run tests $ edit/build/test first part
$ git commit -m 'First part' $ git commit foo -m 'First part' # commit fully tested change
$ git stash apply $ git stash pop # prepare to work on all other changes
$ build && run tests ... repeat above five steps until one commit remains ...
$ git commit -a -m 'Second part' $ edit/build/test remaining parts
$ git commit foo -m 'Remaining parts'
---------------------------------------------------------------- ----------------------------------------------------------------
SEE ALSO SEE ALSO