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

negated list in .gitignore no fun

From
jidanni@jidanni.org <jidanni@jidanni.org>
Date
Dec 18, 2008, 21:53 UTC
Message-ID
<87hc51tajw.fsf@jidanni.org>

I discovered git is so negative: it has very good .gitignore negative matching facilities, but not as good positive matching facilities. (Maybe positive glob lists are merely fed to git-add from the command line.)

I had dreams of tracking only a few files in a large tree. I thought I would maintain that list as a negated list in .gitignore, and then always use "git-add ." to keep git's index reflecting my list.

However that's just not possible.

# head -n 5 .gitignore * !X11/xorg.conf !anacrontab !apt/apt.conf.d/10jidanni !apt/sources.list # git-add . But git-status only shows anacrontab got added. None of the files in the subdirectories get added. We continue, # sed -n s/^!//p .gitignore|xargs git-add #no help! # sed -n s/^!//p .gitignore|xargs -n 1 git-add #Geez. Finally worked. OK, I suppose my next step is just to rm .gitignore and just add any future files I want to add to my list one by one with git-add... like git was designed to do in the first place. OK, thanks. Bye. Next episode: some kind of middle ground with etckeeper.

Next: Boyd Stephen Smith Jr.
Message 1 of 4 in “negated list in .gitignore no fun”
  1. jidanni@jidanni.orgDec 18, 2008
  2. Boyd Stephen Smith Jr.Dec 18, 2008
  3. Linus TorvaldsDec 18, 2008
  4. Linus TorvaldsDec 18, 2008

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.