{"thread":{"id":"57805","subject":"Git stash create with untracked files?","startedAt":"2022-04-27T11:02:29Z","lastAt":"2022-04-27T21:54:29Z","messageCount":2,"participants":["Tao Klerks","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"454491","messageId":"CAPMMpoj1pF=FfRg6Rgz6bP2mZaQhApL7QQx9=2U7i4AE4zsJ1w@mail.gmail.com","threadId":"57805","inReplyTo":null,"subject":"Git stash create with untracked files?","fromName":"Tao Klerks","fromEmail":"tao@klerks.biz","sentAt":"2022-04-27T10:42:51Z","receivedAt":"2022-04-27T11:02:29Z","isPatch":false,"sender":{"key":"tao@klerks.biz","avatar":"https://avatars.githubusercontent.com/u/531704?v=4"},"body":"Hi folks,\n\nI'm just checking in case I'm missing something: Is there any way to\ntell \"git stash create\" to include untracked files?\n\nSomeone recently brought up a situation where they'd like to take a\nworking directory state (incl untracked but not-ignored files), and\nreproduce it in another working directory on another machine; \"git\nstash create\" seems to be ideal for this purpose, save for the\n(apparent) lack of arguments support.\n\nIf this is not possible today and we wanted to better support this\nusecase, what would be a sensible way to do it? I can see three\npossible directions:\n\n1) Change the \"create\" subcommand to treat specific options as options\nrather than the stash message (and make it understand -u /\n--include-untracked)\n\n2) Create a new subcommand like \"create\" that actually supported\nrelevant options (--include-untracked, --staged, maybe also\npathspecs), without changing the contract of \"create\"\n\n3) Add an option to the \"save\" subcommand, asking it to actually leave\nthe working tree untouched (like create does) - and then expect the\nuser of this usecase to \"drop\".\n\n\nIt's possible to just use the existing \"push\" and then immediately\n\"pop\", but the resulting temporary changes to the working tree could\nmake things like IDEs go into an unhappy indexing frenzy, depending on\nthe amount of local change.\n\nI realize there's the \"make stashes refs\" work ongoing that's related\nto this, but I don't think I've seen anything there that directly\naddresses this \"make my local changes be available over there\n*without* touching my working tree\" requirement.\n\nThanks,\nTao\n"},{"id":"454553","messageId":"Ymm7iKKn/1I/YwOk@camp.crustytoothpaste.net","threadId":"57805","inReplyTo":"CAPMMpoj1pF=FfRg6Rgz6bP2mZaQhApL7QQx9=2U7i4AE4zsJ1w@mail.gmail.com","subject":"Re: Git stash create with untracked files?","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-04-27T21:54:16Z","receivedAt":"2022-04-27T21:54:29Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2022-04-27 at 10:42:51, Tao Klerks wrote:\n> Hi folks,\n> \n> I'm just checking in case I'm missing something: Is there any way to\n> tell \"git stash create\" to include untracked files?\n> \n> Someone recently brought up a situation where they'd like to take a\n> working directory state (incl untracked but not-ignored files), and\n> reproduce it in another working directory on another machine; \"git\n> stash create\" seems to be ideal for this purpose, save for the\n> (apparent) lack of arguments support.\n\nI don't think there's support for that right now, looking at the code.\n\n> If this is not possible today and we wanted to better support this\n> usecase, what would be a sensible way to do it? I can see three\n> possible directions:\n> \n> 1) Change the \"create\" subcommand to treat specific options as options\n> rather than the stash message (and make it understand -u /\n> --include-untracked)\n\nThis seems reasonable.  do_create_stash already takes several arguments\nspecifying what to include, so it's probably just a matter of parsing\noptions in create_stash and passing the proper arguments to\ndo_create_stash.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"}]}