Re: "git rm" seems to do recursive removal even without "-r"
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Oct 8, 2017, 12:23 UTC
- Message-ID
- <CAN0heSqvz1ak8BvM=i9FGPm=_4Fi7WLhZhPMN37GN-VngewkuA@mail.gmail.com>
- In-Reply-To
- <alpine.LFD.2.21.1710080736530.21897@localhost.localdomain>
On 8 October 2017 at 13:56, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
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' > $
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
subdir/git-foo.sh.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.