git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Apparent bug in 'git stash push <subdir>' loses untracked files

From
IDIgor Djordjevic <igor.d.djordjevic@gmail.com>
Date
Dec 13, 2017, 23:46 UTC
Message-ID
<ee9e6b8b-278e-0b86-cd35-c5d490ed7700@gmail.com>
In-Reply-To
<20171213231414.GD24597@hank>
Hi Thomas,
On 14/12/2017 00:14, Thomas Gummerer wrote:
Show 13 quoted lines
> 
> > For what it`s worth, using `git stash save <subdir>` instead seems
> > to (still) work as expected...
> 
> I think that depends on what you expect ;) 'git stash save <subdir>' 
> will create a stash of the whole working directory with the message 
> "<subdir>". 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 <subdir>.
> 
> In that case 'git stash save <subdir>' would include the tracked
> files outside of <subdir>, while what I assume Reid wanted is to keep
> them in place, and only stash the files in <subdir>.

Indeed, I didn`t pay enough attention to the fact that even `git stash save\push` produced different output messages, the difference being exactly automatic (push) versus provided (save) stash message.

And I did use `git stash save <message>` in the past... :$ Not too often, I guess.

Show 11 quoted lines
> > 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.

Yeah, I`m aware of the "transition", thus teaching myself to use `git stash push` lately. That`s also what made me curious to try out the "old" `git stash save` behavior, but obviously in a bit hasty manner.

Sorry for the confusion, and thanks, for both clarification and your work.

Regards, Buga
Previous: Thomas GummererNext: Thomas Gummerer
Message 4 of 10 in “Apparent bug in 'git stash push <subdir>' loses untracked files”
  1. Reid PriceDec 13, 2017
  2. Igor DjordjevicDec 13, 2017
  3. Thomas GummererDec 13, 2017
  4. Igor DjordjevicDec 13, 2017
  5. Thomas GummererDec 13, 2017
  6. Junio C HamanoDec 16, 2017
  7. Thomas GummererDec 17, 2017
  8. Junio C HamanoDec 18, 2017
  9. Thomas GummererJan 5, 2018
  10. stash: don't delete untracked files that match pathspecThomas Gummerer, Jan 6, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.