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