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

Is Git Add Supposed to Work Like This (git 2.50)?

From
Jon Forrest <nobozo@gmail.com>
Date
Sep 7, 2025, 02:02 UTC
Message-ID
<63045080-74d6-4835-9d9c-4d3558acdbfb@gmail.com>
(Linux fedora 6.16.4-200.fc42.x86_64)

Let's say I have the file "x" in my working directory, but not "bogus_file".

If I run
	git add x bogus_file
I get
	fatal: pathspec 'bogus_file' did not match any files

This is what I expect. However, if I look at what's in the index, "x" doesn't appear. The same thing happens if I specify 15 valid files followed by 1 invalid file.

Apparently the presence of even 1 invalid file invalidates the whole 'git add' command, no matter how many valid files are included.

Is this deliberate?

Cordially, Jon Forrest

Next: K Jayatheerth
Message 1 of 9 in “Is Git Add Supposed to Work Like This (git 2.50)?”
  1. Jon ForrestSep 7, 2025
  2. Re Is Git Add Supposed to Work Like This (git 2.50)?K Jayatheerth, Sep 7, 2025
  3. Jeff KingSep 7, 2025
  4. Jon ForrestSep 9, 2025
  5. Jon ForrestSep 9, 2025
  6. Jeff KingSep 9, 2025
  7. Junio C HamanoSep 9, 2025
  8. Jeff KingSep 9, 2025
  9. Jeff KingSep 9, 2025

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.