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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert P. J. Day wrote:

 was just testing variations of "git rm", and man page claims:

-r Allow recursive removal when a leading directory name is given.

i tested this on the "pro git" book repo, which contains a top-level "book/" directory, and quite a number of "*.asc" files in various subdirectories one or more levels down. i ran:

 $ git rm book/\*.asc

and it certainly seemed to delete *all* "*.asc" files no matter where they were under book/, even without the "-r" option.

 am i misunderstanding something?

By shell-escaping the *, you're letting git perform the file glob. The DISCUSSION section of git-rm(1) says "File globbing matches across directory boundaries."

# With bash performing file globbing
$ git rm -n Documentation/*.txt | wc -l
199

# With git performing file globbing
$ git rm -n Documentation/\*.txt | wc -l
578

--
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Whenever you find yourself on the side of the majority, it is time to
pause and reflect.
   -- Mark Twain




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux