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

Re: Query about gitignore

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 7, 2024, 05:43 UTC
Message-ID
<ZcMYiOxBA-N0NwWT@tanuki>
In-Reply-To
<B7F364DA-27E7-4BDC-93EE-32E6430B6ACE@gmail.com>
Hi Divyaditya,
On Wed, Feb 07, 2024 at 01:56:34AM +0530, Divyaditya Singh wrote:
Show 7 quoted lines
> Hello there,
> 
> I hope you are having a wonderful day.
> 
> I apologize if this is inappropriate but I wanted to ask is there a
> way that I can make my .gitignore such that it ignores the entire
> parent directory of a matching file.
Not inappropriate at all!

Rephrasing what you say, you basically want to ignore "dir/" if and only if "dir/a" exists and matches a specific pattern in your gitignore, right? If so, this is not something that you can currently achieve with gitignores.

Would you mind maybe explaining your particular usecase a bit more? This _could_ help to find a different solution for you. But even if there is none it might motivate others to think about possible ways to implement this in Git if there is interest.

Patrick
Previous: Divyaditya SinghNext: Patrick Steinhardt
Message 2 of 3 in “Query about gitignore”
  1. Divyaditya SinghFeb 6, 2024
  2. Patrick SteinhardtFeb 7, 2024
  3. Patrick SteinhardtMar 4, 2024

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.