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

Re: "git rm" seems to do recursive removal even without "-r"

From
René Scharfe <l.s.r@web.de>
Date
Oct 8, 2017, 12:39 UTC
Message-ID
<05775b3d-2e88-9ceb-e8d2-8ff2373cfdb5@web.de>
In-Reply-To
<alpine.LFD.2.21.1710080736530.21897@localhost.localdomain>
[My SMTP server still refuses to accept emails to rpjday@crashcourse.ca
 and reports "mailbox unavailable" and "invalid DNS MX or A/AAAA resource
 record."  So just replying to the list.]
Am 08.10.2017 um 13:56 schrieb Robert P. J. Day:
Show 16 quoted lines
>    but as i asked in my earlier post, if i wanted to remove *all* files
> with names of "Makefile*", why can't i use:
> 
>    $ git rm 'Makefile*'
> 
> just as i used:
> 
>    $ git rm '*.c'
> 
> are those not both acceptable fileglobs? why does the former clearly
> only match the top-level Makefile, and refuse to cross directory
> boundaries?
> 
>    $ git rm -n 'Makefile*'
>    rm 'Makefile'
>    $
Try:
	$ git rm -n '*Makefile'

The whole path is considered. The asterisk there matches any directory part -- but also any file name prefix. Check the entry for "pathspec" in gitglossary(7) for more details.

René
Previous: Martin ÅgrenNext: Robert P. J. Day
Message 17 of 29 in “"git rm" seems to do recursive removal even without "-r"”
  1. Robert P. J. DayOct 7, 2017
  2. Todd ZullingerOct 7, 2017
  3. Robert P. J. DayOct 7, 2017
  4. Jeff KingOct 7, 2017
  5. Robert P. J. DayOct 7, 2017
  6. Jeff KingOct 7, 2017
  7. Robert P. J. DayOct 7, 2017
  8. Theodore Ts'oOct 7, 2017
  9. Robert P. J. DayOct 7, 2017
  10. Paul SmithOct 7, 2017
  11. Robert P. J. DayOct 7, 2017
  12. Junio C HamanoOct 8, 2017
  13. Robert P. J. DayOct 8, 2017
  14. Kevin DaudtOct 8, 2017
  15. Robert P. J. DayOct 8, 2017
  16. Martin ÅgrenOct 8, 2017
  17. René ScharfeOct 8, 2017
  18. Robert P. J. DayOct 8, 2017
  19. Heiko VoigtOct 10, 2017
  20. Robert P. J. DayOct 11, 2017
  21. Paul SmithOct 8, 2017
  22. Theodore Ts'oOct 8, 2017
  23. Robert P. J. DayOct 8, 2017
  24. Theodore Ts'oOct 8, 2017
  25. Jeff KingOct 9, 2017
  26. Robert P. J. DayOct 10, 2017
  27. Junio C HamanoOct 10, 2017
  28. Paul SmithOct 10, 2017
  29. Robert P. J. DayOct 10, 2017

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.