{"thread":{"id":"10091","subject":"suggestion for git stash","startedAt":"2007-09-30T18:50:41Z","lastAt":"2007-09-30T22:30:27Z","messageCount":6,"participants":["Bruno Haible","Junio C Hamano","Matthieu Moy","Johannes Schindelin","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54417","messageId":"200709302050.41273.bruno@clisp.org","threadId":"10091","inReplyTo":null,"subject":"suggestion for git stash","fromName":"Bruno Haible","fromEmail":"bruno@clisp.org","sentAt":"2007-09-30T18:50:41Z","receivedAt":"2007-09-30T18:50:41Z","isPatch":false,"sender":{"key":"bruno@clisp.org","avatar":null},"body":"Hi,\n\n\"git stash\" has the effect of losing the distinction between untracked\nchanges and changes in the index.\n\nTo reproduce:\n- Clone the gnulib repository or of any repository with at least 2 files.\n- Make changes to two files, say, README and NEWS.\n  $ git add README\n- $ git status\n  now reports:\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       modified:   README\n#\n# Changed but not updated:\n#   (use \"git add <file>...\" to update what will be committed)\n#\n#       modified:   NEWS\n#\n\n- $ git stash\n- $ git stash apply\n- $ git status\n  now reports:\n# On branch master\n# Changed but not updated:\n#   (use \"git add <file>...\" to update what will be committed)\n#\n#       modified:   NEWS\n#       modified:   README\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nCould \"git stash\" be changed to memorize which changes were already\nscheduled for commit and which didn't?\n\nBruno\n"},{"id":"54422","messageId":"7vfy0vhqkl.fsf@gitster.siamese.dyndns.org","threadId":"10091","inReplyTo":"200709302050.41273.bruno@clisp.org","subject":"Re: suggestion for git stash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-30T19:59:54Z","receivedAt":"2007-09-30T19:59:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Isn't \"stash apply --index\" what you talk about?\n"},{"id":"54430","messageId":"vpqk5q77va7.fsf@bauges.imag.fr","threadId":"10091","inReplyTo":"7vfy0vhqkl.fsf@gitster.siamese.dyndns.org","subject":"Re: suggestion for git stash","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-09-30T20:28:16Z","receivedAt":"2007-09-30T20:28:16Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Isn't \"stash apply --index\" what you talk about?\n\nIt doesn't seem to be documented in Documentation/git-stash.txt, but\nseems to be the answer.\n\n-- \nMatthieu\n"},{"id":"54432","messageId":"200709302259.11731.bruno@clisp.org","threadId":"10091","inReplyTo":"7vfy0vhqkl.fsf@gitster.siamese.dyndns.org","subject":"Re: suggestion for git stash","fromName":"Bruno Haible","fromEmail":"bruno@clisp.org","sentAt":"2007-09-30T20:59:11Z","receivedAt":"2007-09-30T20:59:11Z","isPatch":false,"sender":{"key":"bruno@clisp.org","avatar":null},"body":"Junio C Hamano wrote:\n> Isn't \"stash apply --index\" what you talk about?\n\nNot really:\n\n$ git status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       modified:   README\n#\n# Changed but not updated:\n#   (use \"git add <file>...\" to update what will be committed)\n#\n#       modified:   NEWS\n#\n$ git stash\nSaved \"WIP on master: 61135ee... Use check_PROGRAMS instead of noinst_PROGRAMS.\"\nHEAD is now at 61135ee... Use check_PROGRAMS instead of noinst_PROGRAMS.\n$ git stash apply --index\nerror: No changes\nConflicts in index. Try without --index.\n\n(This is git version 1.5.3.1.)\n\nI don't know what \"git stash apply --index\" does, since it's not documented.\n\nBruno\n"},{"id":"54440","messageId":"Pine.LNX.4.64.0709302226270.28395@racer.site","threadId":"10091","inReplyTo":"200709302259.11731.bruno@clisp.org","subject":"Re: suggestion for git stash","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-30T21:29:05Z","receivedAt":"2007-09-30T21:29:05Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 30 Sep 2007, Bruno Haible wrote:\n\n> I don't know what \"git stash apply --index\" does, since it's not \n> documented.\n\nIt's documented in code ;-)\n\nNo, really, what it does is trying to reinstate not only the working \ntree's changes, but also the index' ones.  However, this can fail, when \nyou have conflicts (which are stored in the index, where you therefore can \nno longer apply the changes as they were originally).\n\nNow that you know what --index is supposed to do, maybe you are nice \nenough to extend the documentation and post a patch?\n\nThanks,\nDscho\n"},{"id":"54447","messageId":"1191190557-24902-1-git-send-email-vmiklos@frugalware.org","threadId":"10091","inReplyTo":"Pine.LNX.4.64.0709302226270.28395@racer.site","subject":"[PATCH] git stash: document apply's --index switch","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2007-09-30T22:30:27Z","receivedAt":"2007-09-30T22:30:27Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"---\n\nOn Sun, Sep 30, 2007 at 10:29:05PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Now that you know what --index is supposed to do, maybe you are nice\n> enough to extend the documentation and post a patch?\n\nsomething like this?\n\nVMiklos\n\n Documentation/git-stash.txt |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 05f40cf..5723bb0 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -63,7 +63,7 @@ show [<stash>]::\n \tit will accept any format known to `git-diff` (e.g., `git-stash show\n \t-p stash@\\{1}` to view the second most recent stash in patch form).\n \n-apply [<stash>]::\n+apply [--index] [<stash>]::\n \n \tRestore the changes recorded in the stash on top of the current\n \tworking tree state.  When no `<stash>` is given, applies the latest\n@@ -71,6 +71,11 @@ apply [<stash>]::\n +\n This operation can fail with conflicts; you need to resolve them\n by hand in the working tree.\n++\n+If the `--index` option is used, then tries to reinstate not only the working\n+tree's changes, but also the index's ones. However, this can fail, when you\n+have conflicts (which are stored in the index, where you therefore can no\n+longer apply the changes as they were originally).\n \n clear::\n \tRemove all the stashed states. Note that those states will then\n-- \n1.5.3.2.111.g5166-dirty\n"}]}