Web lists-archives.com

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

On 8 October 2017 at 13:56, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
>   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'
>   $

Hmmm. The manpage says the following:

       git rm -f git-*.sh
           Because this example lets the shell expand the asterisk (i.e.
           you are listing the files explicitly), it does not remove

This implies that `git rm "git-*.sh"` should remove subdir/git-foo.sh.
But it doesn't, at least not in my testing. It seems that the globbing
only kicks in when the "*" comes first, as you've noted.