git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git stash push -u deletes untracked files
@ 2018-04-02 16:07 Hosam Aly Mahmoud
  2018-04-02 21:39 ` Thomas Gummerer
  0 siblings, 1 reply; 2+ messages in thread
From: Hosam Aly Mahmoud @ 2018-04-02 16:07 UTC (permalink / raw)
  To: Git Mailing List

Hi,

Using Git 2.16.3 on MacOS 10.13.3, running `git stash push
--include-untracked` deletes the untracked files specified in its
arguments and creates an empty stash commit.

In the example below, I create a repository with a single file and a
single commit. Then I create two untracked files and push one of them
to the stash. Although I get an error, an empty stash commit is
generated and the specified file is deleted.

```
$ git init . && touch README && git commit -m "README"
$ touch my-file my-other-file
$ git status
On branch master
Untracked files:
my-file
my-other-file

nothing added to commit but untracked files present
$ git stash push -u my-file
Saved working directory and index state WIP on master: e89afc6 README
fatal: pathspec 'my-file' did not match any files
error: unrecognized input
$ git status
On branch master
Untracked files:
my-other-file

nothing added to commit but untracked files present
$ git stash list
stash@{0}: WIP on master: e89afc6 README
$ git stash show
$
$ ls
README        my-other-file
```

I tested this using git built from the latest commit on master at the
time of writing (c2a499e6c31ed613a606ffdeb5bb74ab41e9a586) and got the
same results. Could you please check it out?


Thank you,

Hosam Aly

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git stash push -u deletes untracked files
  2018-04-02 16:07 git stash push -u deletes untracked files Hosam Aly Mahmoud
@ 2018-04-02 21:39 ` Thomas Gummerer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gummerer @ 2018-04-02 21:39 UTC (permalink / raw)
  To: Hosam Aly Mahmoud; +Cc: Git Mailing List

On 04/02, Hosam Aly Mahmoud wrote:
> Hi,
> 
> Using Git 2.16.3 on MacOS 10.13.3, running `git stash push
> --include-untracked` deletes the untracked files specified in its
> arguments and creates an empty stash commit.
> 
> In the example below, I create a repository with a single file and a
> single commit. Then I create two untracked files and push one of them
> to the stash. Although I get an error, an empty stash commit is
> generated and the specified file is deleted.

Thanks for your report.  This has been reported first in
https://public-inbox.org/git/349f9369-b799-4f7b-bda1-33bcbd7ea067@syntevo.com/,
and fixed there.  The fix wasn't merged to 'master' yet, but it is in
the 'next' branch.

Now that 2.17 was released, I'd expect this to be merged to 'master'
at some point.  If you'd like to help the fix along, it would be
awesome if you could test the current 'next' branch, and report back
whether or not the fix works for you.

> ```
> $ git init . && touch README && git commit -m "README"
> $ touch my-file my-other-file
> $ git status
> On branch master
> Untracked files:
> my-file
> my-other-file
> 
> nothing added to commit but untracked files present
> $ git stash push -u my-file
> Saved working directory and index state WIP on master: e89afc6 README
> fatal: pathspec 'my-file' did not match any files
> error: unrecognized input
> $ git status
> On branch master
> Untracked files:
> my-other-file
> 
> nothing added to commit but untracked files present
> $ git stash list
> stash@{0}: WIP on master: e89afc6 README
> $ git stash show
> $
> $ ls
> README        my-other-file
> ```
> 
> I tested this using git built from the latest commit on master at the
> time of writing (c2a499e6c31ed613a606ffdeb5bb74ab41e9a586) and got the
> same results. Could you please check it out?
> 
> 
> Thank you,
> 
> Hosam Aly

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-02 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-02 16:07 git stash push -u deletes untracked files Hosam Aly Mahmoud
2018-04-02 21:39 ` Thomas Gummerer

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).