Re: suggestion for git stash

4 messages, 4 authors, 2016-06-15 · open the first message on its own page

Re: suggestion for git stash

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:37

Isn't "stash apply --index" what you talk about?

Re: suggestion for git stash

From: Bruno Haible <hidden>
Date: 2016-06-15 22:43:37

Junio C Hamano wrote:
Isn't "stash apply --index" what you talk about?
Not really:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   README
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   NEWS
#
$ git stash
Saved "WIP on master: 61135ee... Use check_PROGRAMS instead of noinst_PROGRAMS."
HEAD is now at 61135ee... Use check_PROGRAMS instead of noinst_PROGRAMS.
$ git stash apply --index
error: No changes
Conflicts in index. Try without --index.

(This is git version 1.5.3.1.)

I don't know what "git stash apply --index" does, since it's not documented.

Bruno

Re: suggestion for git stash

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:37

Hi,

On Sun, 30 Sep 2007, Bruno Haible wrote:
I don't know what "git stash apply --index" does, since it's not 
documented.
It's documented in code ;-)

No, really, what it does is trying to reinstate not only the working 
tree's changes, but also the index' ones.  However, this can fail, when 
you have conflicts (which are stored in the index, where you therefore can 
no longer apply the changes as they were originally).

Now that you know what --index is supposed to do, maybe you are nice 
enough to extend the documentation and post a patch?

Thanks,
Dscho

[PATCH] git stash: document apply's --index switch

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:37

---

On Sun, Sep 30, 2007 at 10:29:05PM +0100, Johannes Schindelin [off-list ref] wrote:
Now that you know what --index is supposed to do, maybe you are nice
enough to extend the documentation and post a patch?
something like this?

VMiklos

 Documentation/git-stash.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 05f40cf..5723bb0 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -63,7 +63,7 @@ show [<stash>]::
 	it will accept any format known to `git-diff` (e.g., `git-stash show
 	-p stash@\{1}` to view the second most recent stash in patch form).
 
-apply [<stash>]::
+apply [--index] [<stash>]::
 
 	Restore the changes recorded in the stash on top of the current
 	working tree state.  When no `<stash>` is given, applies the latest
@@ -71,6 +71,11 @@ apply [<stash>]::
 +
 This operation can fail with conflicts; you need to resolve them
 by hand in the working tree.
++
+If the `--index` option is used, then tries to reinstate not only the working
+tree's changes, but also the index's ones. However, this can fail, when you
+have conflicts (which are stored in the index, where you therefore can no
+longer apply the changes as they were originally).
 
 clear::
 	Remove all the stashed states. Note that those states will then
-- 
1.5.3.2.111.g5166-dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help