git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git stash --keep-index doesn't have the expected behaviour
@ 2018-02-23  8:15 Daryl Van Den Brink
  0 siblings, 0 replies; only message in thread
From: Daryl Van Den Brink @ 2018-02-23  8:15 UTC (permalink / raw
  To: Git Mailing List

If you search the internet for "git stash only unstaged changes" you
can find much misleading information about what "git stash
--keep-index" does. However, it is my opinion that the --keep-index
option is broken, in that it doesn't do what 90% of people want it to
do - that is, stash only the unstaged changes and not include the
staged changes in the stash. You can find many hacks to work around
this limitation, none of which are very satisfactory.

It was pointed out by some commenters on Stack Overflow that the
examples given in the documentation at
https://git-scm.com/docs/git-stash imply that the intended behaviour
of "git stash --keep-index" is to stash only the unstaged changes.
Based on that, they reason that it's actually a bug. I'm not sure
that's true, but I find the existing behaviour of "--keep-index"
puzzling because I can't think of when I would use it (whereas
stashing only unstaged changes is a feature I would frequently use).

Is it possible that --keep-index could be fixed/improved/modified to
stash only the unstaged changes, or alternatively a new option
introduced which does this?

-- 
Daryl van den Brink
Software Engineer
Maptek | 31 Flemington Street, Glenside, SA 5065, Australia
Tel: +61-8 8338 9222 | Dir: +61-8 8338 9222 | Fax: +61-8 8338 9229
daryl.vandenbrink@maptek.com.au | www.maptek.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-23  8:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23  8:15 git stash --keep-index doesn't have the expected behaviour Daryl Van Den Brink

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).