{"thread":{"id":"44704","subject":"git stash filename - stashing single files.","startedAt":"2016-12-14T14:08:54Z","lastAt":"2016-12-14T15:06:35Z","messageCount":3,"participants":["Jonas Hartmann","Jeff King","Paul Smith"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"307772","messageId":"b528e23b-c763-846e-4040-504a58b690fd@ht-studios.de","threadId":"44704","inReplyTo":null,"subject":"git stash filename - stashing single files.","fromName":"Jonas Hartmann","fromEmail":"jh@ht-studios.de","sentAt":"2016-12-14T13:53:20Z","receivedAt":"2016-12-14T14:08:54Z","isPatch":false,"sender":{"key":"jh@ht-studios.de","avatar":null},"body":"Hello,\n\nhttp://stackoverflow.com/questions/3040833/stash-only-one-file-out-of-multiple-files-that-have-changed-with-git#comment32451416_3040833\n\nCould it be possible to have \"git stash [filename][filename]...\", to\nstash only single files?\nThere seems to be a broad community desire.\n\nBest\n\n-- \nDipl.-Soz. Jonas Hartmann\nHT Studios · Custom-Tailored Software-Engineering\njh@ht-studios.de\n+49 160 9924 4679\nhttp://www.ht-studios.de\n\n\n\nbegin:vcard\nfn:Dipl.-Soz. Jonas Hartmann\nn:Hartmann;Jonas\norg;quoted-printable:HT Studios =C2=B7 Custom-Tailored Software-Engineering;Founder\nadr:;;Mainstr. 93;Pfungstadt;Hessen;64319;Germany\nemail;internet:jh@ht-studios.de\ntitle:Dipl.-Soz.\ntel;work:+49 160 99 24 46 79\nx-mozilla-html:FALSE\nurl:http://www.ht-studios.de\nversion:2.1\nend:vcard\n\n"},{"id":"307778","messageId":"20161214144444.k4v64accedl6xvho@sigill.intra.peff.net","threadId":"44704","inReplyTo":"b528e23b-c763-846e-4040-504a58b690fd@ht-studios.de","subject":"Re: git stash filename - stashing single files.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-12-14T14:44:44Z","receivedAt":"2016-12-14T14:44:52Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 14, 2016 at 02:53:20PM +0100, Jonas Hartmann wrote:\n\n> http://stackoverflow.com/questions/3040833/stash-only-one-file-out-of-multiple-files-that-have-changed-with-git#comment32451416_3040833\n> \n> Could it be possible to have \"git stash [filename][filename]...\", to\n> stash only single files?\n> There seems to be a broad community desire.\n\nI think this would be useful.  You can pick and choose with \"git stash\n-p\", but I have still often wanted \"git stash -p [filename]\".\n\nThere is one problem, though: any non-option arguments to \"git stash\nsave\" are interpreted as the stash message. So just:\n\n  git stash save file\n\nwould break backwards compatibility. Annoyingly, so would:\n\n  git stash save -- file\n\nwhich uses the \"--\" to let you have a message which starts with a dash.\n\nPersonally, I think this is a pretty terrible interface. Besides the\nfact that I have never written a stash message in all my years of using\ngit, it's totally inconsistent with the rest of git (which would use\n\"-m\" for the message, and treat arguments as pathspecs).\n\nSo it might be worth changing, but we'd probably have to deal with the\nbackwards compatibility fallout, have a deprecation period, etc.\n\nAs for \"git stash\" without \"save\", there is magic to rewrite:\n\n  git stash [opts]\n\ninto\n\n  git stash save [opts]\n\nbut it explicitly does not allow non-option arguments. So:\n\n  git stash foo\n\nis an error (and not unreasonably, since \"git stash list\" creates an\nambiguity problem). Perhaps:\n\n  git stash -- foo\n\ncould be allowed to treat \"foo\" as a filename. There wouldn't be any\nbackwards compatibility problems, though it would be weird and\ninconsistent to be able to specify filenames via the \"shortcut\"\ninvocation, but not with \"git stash save\".\n\n-Peff\n"},{"id":"307780","messageId":"1481727610.4552.8.camel@mad-scientist.net","threadId":"44704","inReplyTo":"20161214144444.k4v64accedl6xvho@sigill.intra.peff.net","subject":"Re: git stash filename - stashing single files.","fromName":"Paul Smith","fromEmail":"paul@mad-scientist.net","sentAt":"2016-12-14T15:00:10Z","receivedAt":"2016-12-14T15:06:35Z","isPatch":false,"sender":{"key":"paul@mad-scientist.net","avatar":"https://avatars.githubusercontent.com/u/109636?v=4"},"body":"On Wed, 2016-12-14 at 09:44 -0500, Jeff King wrote:\n> Personally, I think this is a pretty terrible interface. Besides the\n> fact that I have never written a stash message in all my years of using\n> git, it's totally inconsistent with the rest of git (which would use\n> \"-m\" for the message, and treat arguments as pathspecs).\n\nI agree that this is a terrible (and inconsistent) interface and I would\nlove to see it changed.\n\nI do use messages on stashes all the time (because I can never remember\ntheir context a week later without a hint--just looking at the diff is\nnot enough for me) but I would welcome this change.  Definitely the\nfirst step would be introducing the \"-m\" option so people and tools\ncould begin the switch to using it.\n"}]}