{"thread":{"id":"48202","subject":"git stash push -u deletes untracked files","startedAt":"2018-04-02T16:08:00Z","lastAt":"2018-04-02T20:36:26Z","messageCount":2,"participants":["Hosam Aly Mahmoud","Thomas Gummerer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"343584","messageId":"CAJA-u1okS1GO8+mHGbz23cs0CRt7wQAPHHsnvmZnZe4ZOf2VqQ@mail.gmail.com","threadId":"48202","inReplyTo":null,"subject":"git stash push -u deletes untracked files","fromName":"Hosam Aly Mahmoud","fromEmail":"hosamaly6@gmail.com","sentAt":"2018-04-02T16:07:13Z","receivedAt":"2018-04-02T16:08:00Z","isPatch":false,"sender":{"key":"hosamaly6@gmail.com","avatar":"https://gravatar.com/avatar/0e26156a8f5c39fd6e63da9eaa92d0b5a098ca6eac70c594f5fc39d270b46b6e?d=mp&s=160"},"body":"Hi,\n\nUsing Git 2.16.3 on MacOS 10.13.3, running `git stash push\n--include-untracked` deletes the untracked files specified in its\narguments and creates an empty stash commit.\n\nIn the example below, I create a repository with a single file and a\nsingle commit. Then I create two untracked files and push one of them\nto the stash. Although I get an error, an empty stash commit is\ngenerated and the specified file is deleted.\n\n```\n$ git init . && touch README && git commit -m \"README\"\n$ touch my-file my-other-file\n$ git status\nOn branch master\nUntracked files:\nmy-file\nmy-other-file\n\nnothing added to commit but untracked files present\n$ git stash push -u my-file\nSaved working directory and index state WIP on master: e89afc6 README\nfatal: pathspec 'my-file' did not match any files\nerror: unrecognized input\n$ git status\nOn branch master\nUntracked files:\nmy-other-file\n\nnothing added to commit but untracked files present\n$ git stash list\nstash@{0}: WIP on master: e89afc6 README\n$ git stash show\n$\n$ ls\nREADME        my-other-file\n```\n\nI tested this using git built from the latest commit on master at the\ntime of writing (c2a499e6c31ed613a606ffdeb5bb74ab41e9a586) and got the\nsame results. Could you please check it out?\n\n\nThank you,\n\nHosam Aly\n"},{"id":"343624","messageId":"20180402213944.GF2629@hank","threadId":"48202","inReplyTo":"CAJA-u1okS1GO8+mHGbz23cs0CRt7wQAPHHsnvmZnZe4ZOf2VqQ@mail.gmail.com","subject":"Re: git stash push -u deletes untracked files","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2018-04-02T21:39:48Z","receivedAt":"2018-04-02T20:36:26Z","isPatch":false,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"On 04/02, Hosam Aly Mahmoud wrote:\n> Hi,\n> \n> Using Git 2.16.3 on MacOS 10.13.3, running `git stash push\n> --include-untracked` deletes the untracked files specified in its\n> arguments and creates an empty stash commit.\n> \n> In the example below, I create a repository with a single file and a\n> single commit. Then I create two untracked files and push one of them\n> to the stash. Although I get an error, an empty stash commit is\n> generated and the specified file is deleted.\n\nThanks for your report.  This has been reported first in\nhttps://public-inbox.org/git/349f9369-b799-4f7b-bda1-33bcbd7ea067@syntevo.com/,\nand fixed there.  The fix wasn't merged to 'master' yet, but it is in\nthe 'next' branch.\n\nNow that 2.17 was released, I'd expect this to be merged to 'master'\nat some point.  If you'd like to help the fix along, it would be\nawesome if you could test the current 'next' branch, and report back\nwhether or not the fix works for you.\n\n> ```\n> $ git init . && touch README && git commit -m \"README\"\n> $ touch my-file my-other-file\n> $ git status\n> On branch master\n> Untracked files:\n> my-file\n> my-other-file\n> \n> nothing added to commit but untracked files present\n> $ git stash push -u my-file\n> Saved working directory and index state WIP on master: e89afc6 README\n> fatal: pathspec 'my-file' did not match any files\n> error: unrecognized input\n> $ git status\n> On branch master\n> Untracked files:\n> my-other-file\n> \n> nothing added to commit but untracked files present\n> $ git stash list\n> stash@{0}: WIP on master: e89afc6 README\n> $ git stash show\n> $\n> $ ls\n> README        my-other-file\n> ```\n> \n> I tested this using git built from the latest commit on master at the\n> time of writing (c2a499e6c31ed613a606ffdeb5bb74ab41e9a586) and got the\n> same results. Could you please check it out?\n> \n> \n> Thank you,\n> \n> Hosam Aly\n"}]}