From: Thomas Gummerer Date: Wed, 13 Dec 2017 23:14:14 GMT Subject: Re: Apparent bug in 'git stash push ' loses untracked files Message-ID: <20171213231414.GD24597@hank> In-Reply-To: <0692d5b8-5fc7-c34c-0712-11a913267441@gmail.com> On 12/13, Igor Djordjevic wrote: > Hi Reid, > > On 13/12/2017 18:32, Reid Price wrote: > > > > When running 'git stash push ' if there are both tracked and > > untracked files in this subdirectory, the tracked files are stashed > > but the untracked files are discarded. > > I can reproduce this as well (git version 2.15.1.windows.2). > > For what it`s worth, using `git stash save ` instead seems to > (still) work as expected... I think that depends on what you expect ;) 'git stash save ' will create a stash of the whole working directory with the message "". So while it would indeed work for the presumably simplified example Reid provided, it would not do what you'd expect if there are any tracked and modified files outside of the . In that case 'git stash save ' would include the tracked files outside of , while what I assume Reid wanted is to keep them in place, and only stash the files in . > but on the other hand, `git-stash`[1] > manpage seems not to mention this usage ("save" with "pathspec")? "stash save" with "pathspec" doesn't exist, and it will probably never exist. We decided to introduce a new "push" verb for 'git stash' because the command line for 'git stash save' takes a message as its last argument, instead of taking the message with a -m flag like other commands do. Introducing a pathspec argument for "git stash save" would have either broken backward compatibility, or it would have had some syntax that's very inconsistent with other git commands. > Regards, Buga > > [1] https://git-scm.com/docs/git-stash