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

Bug in .gitignore handling

From
TTTommy Thorn <tommy-git@thorn.ws>
Date
Mar 26, 2008, 20:01 UTC
Message-ID
<47EAABB6.30803@thorn.ws>

For reasons too upsetting to explain, I have to keep a collection of symlinks inside my tree but outside of git's control, such as

mydir/foo -> ../otherdir/foo
To stop git clean from removing it, I added "foo" to .gitignore

The problem is that I foo appears in build paths inside the tree that I would like git clean to pick up, however the pattern "foo" is applied generally and matches stuff like

mydir/mousetrap/foo/objs

According to the man page, I should be able to change .gitignore to "foo/" to stop it from looking recursively, but that doesn't work, as now git clean -n -f -d wants to remove mydir/foo but not mydir/foo/objs

My desperate attempts "./foo" and "^foo" also didn't work. Please note that this is a vastly simplified version of the real problem, so I can't just use "!mousetrap/foo".

It seems "foo/" _should_ work even though foo isn't a directory.

Thanks Tommy

Next: Junio C Hamano
Message 1 of 7 in “Bug in .gitignore handling”
  1. Tommy ThornMar 26, 2008
  2. Junio C HamanoMar 26, 2008
  3. Tommy ThornMar 26, 2008
  4. Linus TorvaldsMar 26, 2008
  5. Linus TorvaldsMar 26, 2008
  6. Tommy ThornMar 26, 2008
  7. Junio C HamanoMar 26, 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.