{"thread":{"id":"14341","subject":"PATCH] Documentation: Tweak use case in \"git stash save --keep-index\"","startedAt":"2008-07-08T05:18:03Z","lastAt":"2008-07-08T07:40:56Z","messageCount":3,"participants":["Eric Raible","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"82553","messageId":"279b37b20807072218o19dabd97y2c4edc62fb980ca4@mail.gmail.com","threadId":"14341","inReplyTo":null,"subject":"PATCH] Documentation: Tweak use case in \"git stash save --keep-index\"","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2008-07-08T05:18:03Z","receivedAt":"2008-07-08T05:18:03Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"The documentation suggests using \"git stash apply\" in the\n--keep-index workflow even though doing so will lead to clutter\nin the stash.  And given that the changes are about to be\ncommitted anyway \"git stash pop\" is more sensible.\n\nAdditionally the text preceeding the example claims that it\nworks for \"two or more commits\", but the example itself is\nreally tailored for just two.  Expanding it just a little\nmakes it clear how the procedure generalizes to N commits.\n\nSigned-off-by: Eric Raible <raible@gmail.com>\n---\nNote that this is relative to Junio's pu branch (v1.5.6.2-397-g20210bb)\n\n Documentation/git-stash.txt |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex df26901..bf241da 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -201,9 +201,10 @@ $ git add --patch foo\n $ git stash save --keep-index\n $ build && run tests\n $ git commit -m 'First part'\n-$ git stash apply\n+$ git stash pop\n+... repeat above five steps until one commit remains ...\n $ build && run tests\n-$ git commit -a -m 'Second part'\n+$ git commit foo -m 'Remaining parts'\n ----------------------------------------------------------------\n\n SEE ALSO\n-- \n1.5.6.1.1073.g489ff.dirty\n"},{"id":"82556","messageId":"7vlk0dvsr5.fsf@gitster.siamese.dyndns.org","threadId":"14341","inReplyTo":"279b37b20807072218o19dabd97y2c4edc62fb980ca4@mail.gmail.com","subject":"Re: PATCH] Documentation: Tweak use case in \"git stash save --keep-index\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-08T05:39:58Z","receivedAt":"2008-07-08T05:39:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Eric Raible\" <raible@gmail.com> writes:\n\n> The documentation suggests using \"git stash apply\" in the\n> --keep-index workflow even though doing so will lead to clutter\n> in the stash.  And given that the changes are about to be\n> committed anyway \"git stash pop\" is more sensible.\n\nYeah, I was pondering about this myself.  After popping the remaining\npart, you would \"git add -p\" the next batch, the same \"stash save -k-i\" to\nsave the remaining bits away, and continue.  Will queue.\n\nBUT\n\nIt is very likely that in this workflow you would sometimes find that what\nyou staged (and left in the working tree after \"save -k-i\") is faulty and\nyou need to tweak it in place to make it into a good enough shape for\ncommitting.  The example probably should talk about what happens.\nEditing, testing and committing is fine, but then what?  Will the \"pop\"\nwipe that unplanned change you made after \"save -k-i\" out? (the answer is\nno and this is safe, but the reader of the documentaiton needs it\nexplained)\n\nAlso this may be a good way to split an existing commit into five during a\n\"rebase -i\" session, and the example in the documentation might want to\ntalk about it in that larger picture.\n\n>  Documentation/git-stash.txt |    5 +++--\n>  1 files changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\n> index df26901..bf241da 100644\n> --- a/Documentation/git-stash.txt\n> +++ b/Documentation/git-stash.txt\n> @@ -201,9 +201,10 @@ $ git add --patch foo\n>  $ git stash save --keep-index\n>  $ build && run tests\n>  $ git commit -m 'First part'\n> -$ git stash apply\n> +$ git stash pop\n> +... repeat above five steps until one commit remains ...\n>  $ build && run tests\n> -$ git commit -a -m 'Second part'\n> +$ git commit foo -m 'Remaining parts'\n>  ----------------------------------------------------------------\n"},{"id":"82566","messageId":"279b37b20807080040y47b87c35r9b1aa33236a86da6@mail.gmail.com","threadId":"14341","inReplyTo":"7vlk0dvsr5.fsf@gitster.siamese.dyndns.org","subject":"Re: PATCH] Documentation: Tweak use case in \"git stash save --keep-index\"","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2008-07-08T07:40:56Z","receivedAt":"2008-07-08T07:40:56Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"The documentation suggests using \"git stash apply\" in the\n--keep-index workflow even though doing so will lead to clutter\nin the stash.  And given that the changes are about to be\ncommitted anyway \"git stash pop\" is more sensible.\n\nAdditionally the text preceeding the example claims that it\nworks for \"two or more commits\", but the example itself is\nreally tailored for just two.  Expanding it just a little\nmakes it clear how the procedure generalizes to N commits.\n\nFinally the example is annotated with some commentary to\nexplain things on a line-by-line basis.\n---\n[Note: If we can't rely on fixed-width fonts then the resulting\nexample will look stupid]\n\nOn Mon, Jul 7, 2008 at 10:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Also this may be a good way to split an existing commit into five during a\n> \"rebase -i\" session, and the example in the documentation might want to\n> talk about it in that larger picture.\n\nIf you're talking about 'edit' mode, doing a \"reset HEAD^\", and then\nusing the same \"add --patch\"/\"stash save -k-i\"/commit/\"stash pop\"\ncycle in question then I understand and agree.  But only if the\nuser wants to test each part separately.\n\nOtherwise why bother with stash-k-i when you can just loop\non add-patch/commit or use git-gui?\n--\n Documentation/git-stash.txt |   15 ++++++++-------\n 1 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex df26901..7d50d74 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -197,13 +197,14 @@ each change before committing:\n +\n ----------------------------------------------------------------\n ... hack hack hack ...\n-$ git add --patch foo\n-$ git stash save --keep-index\n-$ build && run tests\n-$ git commit -m 'First part'\n-$ git stash apply\n-$ build && run tests\n-$ git commit -a -m 'Second part'\n+$ git add --patch foo            # add just first part to the index\n+$ git stash save --keep-index    # save all other changes to the stash\n+$ edit/build/test first part\n+$ git commit foo -m 'First part' # commit fully tested change\n+$ git stash pop                  # prepare to work on all other changes\n+... repeat above five steps until one commit remains ...\n+$ edit/build/test remaining parts\n+$ git commit foo -m 'Remaining parts'\n ----------------------------------------------------------------\n\n SEE ALSO\n-- \n1.5.6.1.1073.g489ff.dirty\n"}]}