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

Re: refining .gitignores

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Nov 15, 2007, 21:56 UTC
Message-ID
<alpine.LFD.0.9999.0711151349560.4260@woody.linux-foundation.org>
In-Reply-To
<20071115211727.GC3552@steel.home>
On Thu, 15 Nov 2007, Alex Riesen wrote:
> 
> No, I honestly believed that Git-known files can be ignored. According
> to Linus I must be wrong, but I have an excuse:
I do think we're not necessarily entirely consistent wrt ignore files.

In particular, git-ls-files itself actually is pretty special, because it has two totally different modes:

 - you can ask for "other" files (and this is where you'd be expected to 
   use .gitignore)
 - you can just list the files git knows about (and this is where you'd 
   generally be expected to *not* use .gitignore)

..and to make matters more interesting, "git add" used to do the former (it was just a thin script around "git-ls-files -o") but then was later enhanced to also take already-known files into account, so I am not at all surprised if we actually get confused because we used to have a fairly clear separation of the two cases but then we started mixing them up.

So while I think that ".gitignore" *should* only affect files that we don't already know about (ie effectively only file lists that come from "readdir()", not from internal git data structures), I would not be at all surprised if there are bugs.

		Linus
Previous: Alex Riesen
Message 9 of 9 in “refining .gitignores”
  1. Bruce StephensNov 14, 2007
  2. Alex RiesenNov 14, 2007
  3. Bruce StephensNov 15, 2007
  4. Alex RiesenNov 15, 2007
  5. Bruce StephensNov 15, 2007
  6. Linus TorvaldsNov 15, 2007
  7. Bruce StephensNov 15, 2007
  8. Alex RiesenNov 15, 2007
  9. Linus TorvaldsNov 15, 2007

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.