Re: error(?) in "man git-stash" regarding "--keep-index"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18.05.2018 19:14, Martin Ågren wrote:
On 18 May 2018 at 17:43, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux