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

Newbie .gitignore problem

From
JGJonathan Gossage <jgossage@gmail.com>
Date
Sep 22, 2010, 16:41 UTC
Message-ID
<AANLkTin=BwgjqWQ3NfNdL9a1fUnVnFMrmAsmnZjHS=gL@mail.gmail.com>

I am having a problem specifying .gitignore filters properly I have a directory structure as follows:

          repo-root
               |
               -------------------------------------------------------------------
               |                    |
           |
              dir1               dir2  (symlink)
             dir3
                                    |
                ---------------------------------------------------
               |                                                   |
          many directories and files                  dir4

My problem is that I want to exclude all files and sub-directories in dir2 except for dir4 from control by Git. I tried a number of variations on the following .gitignore file in dir2 but either everything was excluded or everything was included. I tested using git add -uall -n

The final .gitignore file was * */* !dir4

How should I go about tackling this. The .gitignore man pages were unclear to me.

Jonathan Gossage
Next: Kevin Ballard
Message 1 of 2 in “Newbie .gitignore problem”
  1. Jonathan GossageSep 22, 2010
  2. Kevin BallardSep 22, 2010

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.