Re: "git rm" seems to do recursive removal even without "-r"
On Tue, 2017-10-10 at 04:36 -0400, Robert P. J. Day wrote:
Show 6 quoted lines
> ah, now *that* is a compelling rationale that justifies the
> underlying weirdness. but it still doesn't explain the different
> behaviour between:
>
> $ git rm -n 'Makefile*'
> $ git rm -n '*Makefile'
I explained that behavior in the email up-thread from this reply:
Show 14 quoted lines
> Globbing in "git rm" matches on the FULL PATH, not just the file name.
> So, if you have a list of Makefiles in your repository like:
>
> Makefile
> foo/Makefile
> bar/Makefile
>
> Then 'Makefile*' only matches the first one, since 'Makefile*' doesn't
> match 'foo/Makefile' or 'bar/Makefile'.
>
> If you you worry that '*Makefile' will match things you don't want to
> match, you'll have to use:
>
> git rm -n Makefile '*/Makefile'