All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sybille Peters <sypets@gmx.de>
To: Git Mailing list <git@vger.kernel.org>
Subject: Re: error(?) in "man git-stash" regarding "--keep-index"
Date: Sat, 19 May 2018 12:05:29 +0200	[thread overview]
Message-ID: <2472f005-4d60-7342-2e59-f60da036f622@gmx.de> (raw)
In-Reply-To: <CAN0heSq6YLarECVtHiPFNyUMNb-XwLQqTULpB_pSW+JZsCMw0Q@mail.gmail.com>

On 18.05.2018 19:14, Martin Ågren wrote:
> On 18 May 2018 at 17:43, Robert P. J. Day <rpjday@crashcourse.ca> wrote:

...

> Ah, this is about saving to the stash vs stashing away. The latter is
> what `git stash` is all about -- stashing changes *away*. At least
> according to my mental model and the top of the man-page.

Stashing changes *away* would mean a move in my mental model (as in
command line mv): Whatever gets copied to stash gets removed in working 
area. And what doesn't get removed, doesn't get copied to stash.

Thus, --keep-index *would* ignore the index and only move working-tree
to the stash minus the changes already staged.

BUT, that might lead to other problems, I suppose.

The current behaviour can cause problems as in the Stackoverflow
question where someone already staged some hunks, and on
stashing with -p gets asked about these *again*. Which does make
the workflow more tedious.


> 
> ...
> 
> The work flow in the example is about temporarily stashing a few changes
> (changes B) to test a couple of others (changes A). Whether the stash
> entry contains changes A or not is practically irrelevant to the use
> case. At pop-time, auto-merging will do the correct thing.

Aha, now it gets interesting. So you are saying, it doesn't matter if
the stash entry also contains the already staged changes A? Well in the 
combination with -p it does (see Stackoverflow question and above).

Even if auto-merging will take care of it (?), it would be good to
have the manpage clarify things that might confuse people.

Disclaimer: I am not a git expert, so I may be getting things wrong. I
just noticed the Stackoverflow question, answered it (only because
an adequate answer did not exist yet) and then saw a similar topic
being raised here.

> 
> So how about "All changes are saved to the stash. Those that have been
> added to the index are left intact in the working tree, all others are
> removed from the working tree."? That's quite a lot of text. Maybe
> "save all changes to the stash, make the working tree match the index"?
> 
> Or more to the point: "make the working directory match the index" or
> "keep only what is in the index"?


I am not sure yet about the text. Still in the clarifying phase.

Sybille

> 
> Martin
> 

  reply	other threads:[~2018-05-19 10:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  9:37 error(?) in "man git-stash" regarding "--keep-index" Robert P. J. Day
2018-05-18 10:41 ` Martin Ågren
2018-05-18 10:51   ` Robert P. J. Day
2018-05-18 12:25     ` Martin Ågren
2018-05-18 15:37       ` Sybille Peters
2018-05-18 15:43         ` Robert P. J. Day
2018-05-18 17:14           ` Martin Ågren
2018-05-19 10:05             ` Sybille Peters [this message]
2018-05-18 20:24         ` Robert P. J. Day

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2472f005-4d60-7342-2e59-f60da036f622@gmx.de \
    --to=sypets@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.