From: Jeff King Date: Tue, 03 Jan 2012 19:06:12 GMT Subject: Re: Stashing individual files Message-ID: <20120103190612.GC20926@sigill.intra.peff.net> In-Reply-To: On Tue, Jan 03, 2012 at 10:32:02AM +1100, Chris Leong wrote: > Thanks for making such a wonderful product. I find the stash command > really useful, but it doesn't work very well when I just need to > temporarily revert one or two files. I know that there is the > interactive command, but if you have modified a large number of files, > then it takes quite a bit of effort. Is there any way I can define an > alias, stashfiles, so that I can just type git stashfiles file1 file2? > Also, please consider adding such a feature into a future version. I have sometimes wanted this, too. One problem is that the arguments in a "stash save" get sucked into the message. I really wish it were: git stash save [-m ] [[--] ] which would match other git commands. And related, it would be nice to have: git stash foo.c bar.c but that conflicts with our safety-valve to avoid accidentally stashing when no command is given. For now, we could probably do it like this: git stash save [] [-- ] IOW, make the "--" a requirement for specifying filenames. The only regression is that "--" as a single argument can no longer be used in stash messages. So this works now: git stash save working on foo -- needs bar but would be interpreted under my proposal as stashing "needs" and "bar" with the message "working on foo". You would instead have to spell it: git stash save "working on foo -- needs bar" 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. -Peff