git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Stashing individual files

From
Jeff King <peff@peff.net>
Date
Jan 3, 2012, 20:13 UTC
Message-ID
<20120103201323.GA4340@sigill.intra.peff.net>
In-Reply-To
<7vfwfwtup7.fsf@alter.siamese.dyndns.org>
On Tue, Jan 03, 2012 at 12:08:52PM -0800, Junio C Hamano wrote:
Show 7 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I think that would be OK compromise, though. I'd rather not introduce a
> > whole new "stashfiles" command (or even a new subcommand of stash) if we
> > can avoid it.
> 
> Why wouldn't a simple "git diff -- paths >P.diff" work?

For all the same reasons that "git diff >P.diff" is not as good as a regular stash.

> What does such a partial stash leave in the working tree, how does the
> user deal with the remaining local changes, what happens after such a
> partial stash is applied/popped?

I would expect it to stash only the changes in the selected files, restoring them to their state in HEAD, and leave other files untouched.

We already have partial stashing like this via "git stash -p". This is just a shorthand for "say yes to all of the changes in foo.c, and no to everything else". So I don't see it as particularly new or dangerous.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “Stashing individual files”
  1. Chris LeongJan 2, 2012
  2. Jeff KingJan 3, 2012
  3. Junio C HamanoJan 3, 2012
  4. Jeff KingJan 3, 2012
  5. Junio C HamanoJan 3, 2012
  6. Tor ArntsenJan 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.