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

Re: Unexpected recursion in 'git rm'

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 3, 2026, 12:39 UTC
Message-ID
<aketk4ensXGZS4eI@pks.im>
In-Reply-To
<1756071445.20260703123414@gmail.com>
Adding the mailing list back into Cc.
On Fri, Jul 03, 2026 at 12:34:14PM +0300, Евгений Плискин wrote:
Show 10 quoted lines
> > This is expected behaviour, as the argument to git-rm(1) is a pathspec, and "*" matches directory separators by default, see also gitglossary(7) under "pathspec":
> >   • the pathspec up to the last slash represents a directory prefix. The  scope of that pathspec is limited to that subtree.
> >   • the rest of the pathspec is a pattern for the remainder of the pathname. Paths relative to the directory prefix will be matched against that pattern using fnmatch(3); in particular, * and ? can match directory separators.
> >   For example, Documentation/*.jpg will match all .jpg files in the  Documentation subtree, including Documentation/chapter_1/figure_1.jpg.
> > Could you maybe clarify which part of git-rm(1) made you think that this wouldn't happen?
> 
> Thank you for your reply. I believe you are correct.
> 
> I have made more research and found a way to remove files in current directory only without recursion into subdirectories:
>      git rm -n ':(glob)*.json'
Yup, that wouldn't cross directory separators indeed.
Patrick
Previous: Junio C HamanoNext: Matt Hunter
Message 7 of 8 in “Unexpected recursion in 'git rm'”
  1. Евгений ПлискинJul 2, 2026
  2. Matt HunterJul 3, 2026
  3. Patrick SteinhardtJul 3, 2026
  4. Phillip WoodJul 3, 2026
  5. Mikael MagnussonJul 3, 2026
  6. Junio C HamanoJul 3, 2026
  7. Patrick SteinhardtJul 3, 2026
  8. Matt HunterJul 3, 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.