From: Jeff King <peff@peff.net>
To: Jonas Hartmann <jh@ht-studios.de>
Cc: git@vger.kernel.org
Subject: Re: git stash filename - stashing single files.
Date: Wed, 14 Dec 2016 09:44:44 -0500 [thread overview]
Message-ID: <20161214144444.k4v64accedl6xvho@sigill.intra.peff.net> (raw)
In-Reply-To: <b528e23b-c763-846e-4040-504a58b690fd@ht-studios.de>
On Wed, Dec 14, 2016 at 02:53:20PM +0100, Jonas Hartmann wrote:
> http://stackoverflow.com/questions/3040833/stash-only-one-file-out-of-multiple-files-that-have-changed-with-git#comment32451416_3040833
>
> Could it be possible to have "git stash [filename][filename]...", to
> stash only single files?
> There seems to be a broad community desire.
I think this would be useful. You can pick and choose with "git stash
-p", but I have still often wanted "git stash -p [filename]".
There is one problem, though: any non-option arguments to "git stash
save" are interpreted as the stash message. So just:
git stash save file
would break backwards compatibility. Annoyingly, so would:
git stash save -- file
which uses the "--" to let you have a message which starts with a dash.
Personally, I think this is a pretty terrible interface. Besides the
fact that I have never written a stash message in all my years of using
git, it's totally inconsistent with the rest of git (which would use
"-m" for the message, and treat arguments as pathspecs).
So it might be worth changing, but we'd probably have to deal with the
backwards compatibility fallout, have a deprecation period, etc.
As for "git stash" without "save", there is magic to rewrite:
git stash [opts]
into
git stash save [opts]
but it explicitly does not allow non-option arguments. So:
git stash foo
is an error (and not unreasonably, since "git stash list" creates an
ambiguity problem). Perhaps:
git stash -- foo
could be allowed to treat "foo" as a filename. There wouldn't be any
backwards compatibility problems, though it would be weird and
inconsistent to be able to specify filenames via the "shortcut"
invocation, but not with "git stash save".
-Peff
next prev parent reply other threads:[~2016-12-14 14:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 13:53 git stash filename - stashing single files Jonas Hartmann
2016-12-14 14:44 ` Jeff King [this message]
2016-12-14 15:00 ` Paul Smith
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161214144444.k4v64accedl6xvho@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jh@ht-studios.de \
/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.
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).