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

gitignore + commit with excludes = bug

From
PJPaul Jackson <mailnew4ster@gmail.com>
Date
May 1, 2021, 18:37 UTC
Message-ID
<CAGKR6vKwojz8_bs9oRasQPCamZJ-4mrmBKBZQCJKhX=8w+SzDg@mail.gmail.com>
Hello,

I stumbled upon what I believe is a bug in git. See the following reproduction steps:

mkdir test cd test git init echo 1 > ignored echo 1 > not-ignored echo ignored > .gitignore git add -A -- ':!ignored' || echo 'ERROR!!!'

In these steps, I ignore the "ignored" file twice - first time in .gitignore, and second time in the "git add" command. I didn't expect this to be a problem, but I'm getting the following error message:

The following paths are ignored by one of your .gitignore files: ignored

It looks as if git thinks I wanted to include, not exclude "ignored" in "git add".

Next: Philip Oakley
Message 1 of 9 in “gitignore + commit with excludes = bug”
  1. Paul JacksonMay 1, 2021
  2. Philip OakleyMay 4, 2021
  3. Matheus TavaresMay 4, 2021
  4. Paul JacksonMay 9, 2021
  5. Philip OakleyMay 10, 2021
  6. Elijah NewrenMay 10, 2021
  7. Matheus Tavares BernardinoMay 10, 2021
  8. Elijah NewrenMay 10, 2021
  9. Matheus Tavares BernardinoMay 11, 2021

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.