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

Re: .gitignore issue

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 21, 2026, 21:09 UTC
Message-ID
<xmqq343ysmem.fsf@gitster.g>
In-Reply-To
<20260121210312.GA723458@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> On Wed, Jan 21, 2026 at 06:51:02PM +0000, Pushkar Singh wrote:
>
>> This is expected behavior.
>> When a directory matches an ignore rule, Git stops descending into it entirely. The pattern
>> 
>>         backup_STOCKS*/
>> 
>> matches directories starting with backup_STOCKS, and once Git prunes traversal at that level, similarly prefixed paths can disappear from git status, which is why backups/ no longer shows up.
>> 
>> This isn’t a bug, but a result of how ignore patterns and directory pruning work.
>
> I found this explanation confusing: surely we would never match
> "backups/" itself via a pattern like "backup_STOCKS*". And I'm not sure
> what you mean by "similarly prefixed paths".

Great minds think alike. I was writing almost identical response about backups/ being full of backups/backup_STOCKS_{1,2,3,4} and nothing unignored in there.

> We can't know for certain this is what's going on because Alf didn't
> show us what's in the backups/ directory, but one imagines it is also
> full of backup_STOCKS_* directories.
Thanks.
Previous: Jeff King
Message 3 of 3 in “Re: .gitignore issue”
  1. Pushkar SinghJan 21, 2026
  2. Jeff KingJan 21, 2026
  3. Junio C HamanoJan 21, 2026

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.