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

Re: git ignore

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 16, 2008, 23:08 UTC
Message-ID
<7viqpjra57.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.2.00.0812161450010.14014@localhost.localdomain>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 12 quoted lines
> On Tue, 16 Dec 2008, Max Power wrote:
>> 
>> So I understand how to use the .gitignore file to ignore specific
>> files/directories that I put in there... is there a way to ignore everything
>> BUT a given file extension? 
>
> Something like
>
> 	*
> 	!*.jpg
>
> to only save the jpegs in your pr0n collection?

Hmm, do people still keep p0rn collection in jpgs? I somehow had an impression that they moved to avis ;-)

> The first rule says "ignore everything". The second one says "don't 
> ignore *.jpg files".
>
> Untested. 

t3001-ls-files-others-exclude.sh has some tests but there is nothing that explicitly tests overlapping patterns. Perhaps it should (hint, hint...)

"man gitignore" documentation has an example to ignore all *.html files but not foo.html using a similar construct, i.e.

	*.html
        !foo.html
Previous: Linus TorvaldsNext: Michael J Gruber
Message 3 of 7 in “git ignore”
  1. Max PowerDec 16, 2008
  2. Linus TorvaldsDec 16, 2008
  3. Junio C HamanoDec 16, 2008
  4. test overlapping ignore patternsMichael J Gruber, Dec 18, 2008
  5. Stephen HabermanJul 7, 2011
  6. Junio C HamanoJul 8, 2011
  7. Stephen HabermanJul 8, 2011

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.