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

[BUG?] git stash push fails on removed file pathspec

From
AMAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Date
Apr 7, 2022, 03:31 UTC
Message-ID
<100e7faf-af63-7982-04ee-8302799c2f61@syntevo.com>
Hi all,
Steps:
$git init TestRepo && cd TestRepo
$echo 1 >1.txt
$git add . && git commit -m 1
$git rm 1.txt
$git stash push -- 1.txt
   error: pathspec ':(,prefix:0)1.txt' did not match any file(s) known 
to git
   Did you forget to 'git add'?

At the same time, `git stash push` and `git commit -m 1 -- 1.txt` work as expected, stashing/committing removed file.

I tested in these versions and it happens in both:
* 2.36.0.rc0.9.g07330a41d6 (current master)
* 2.35.0
Message 1 of 1 in “[BUG?] git stash push fails on removed file pathspec”
  1. Alexandr MiloslavskiyApr 7, 2022

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.