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

Re: 'git stash push -- {dir}' puts files in stash that are outside of {dir}

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 26, 2023, 17:29 UTC
Message-ID
<xmqqsf9ad1ju.fsf@gitster.g>
In-Reply-To
<5fce9c4f-0ea7-9393-4a30-ddd66946661d@tsoft.com>
Yuri <yuri@tsoft.com> writes:
Show 9 quoted lines
> I am in the FreeBSD ports repository.
>
> I run this command:
>
> $ git stash push -m "gh-print-tuple" -- Mk
>
> But then 'git show' shows that the top stash entry also has other files:
>
> $ git stash show -p stash@{0} | grep diff

Not offering a solution, as a quick test or two in my environment do not reproduce this problem [*]. But instead of the above command, which will show matches on any line that has "diff" in the "-p" output, perhaps

    $ git stash show --stat
is easier to see?

Are there configuration variables set to affect the behaviour of the "git stash" command in your environment that I do not have (I have nothing in "git config -l | grep stash" output), which may be affecting why it does not reproduce for me?

> Why do files that are not under Mk get into stash?
[Footnote]
* Admittedly I didn't recall we had pathspec support to "git stash
  push" so consider me no longer an expert in this area ;-).
Previous: YuriNext: Yuri
Message 2 of 4 in “'git stash push -- {dir}' puts files in stash that are outside of {dir}”
  1. YuriJul 26, 2023
  2. Junio C HamanoJul 26, 2023
  3. YuriJul 26, 2023
  4. Junio C HamanoJul 26, 2023

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.