Re: On removing files and "git-rm is pointless"

3 messages, 3 authors, 2016-08-11 · open the first message on its own page

Re: On removing files and "git-rm is pointless"

From: Horst H. von Brand <hidden>
Date: 2016-08-11 19:52:26

Linus Torvalds [off-list ref] wrote:

[...]
One thing to look out for: "git rm" actually defaults to the recursive 
behaviour, something that might take people by surprise. If you give it a 
directory name, it will happily delete all tracked files from within that 
directory, even without "-r". That is probably a design mistake. So it 
would probably make sense to:

 - without "-r", don't do the partial matches at the beginning (but still 
   do globbing matches, of course, so "git rm dir/*" wouldn't need an 
   "-r", but "git rm -r dir/", which does the same thing, _would_ need an 
   "-r" to be effective)
The command should never even see the '*' here. Globbing is handled
(uniformly) by the shell. Don't loose that.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239

Re: On removing files and "git-rm is pointless"

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-08-11 20:08:19


On Sat, 2 Dec 2006, Horst H. von Brand wrote:
The command should never even see the '*' here. Globbing is handled
(uniformly) by the shell. Don't loose that.
Git supprts an extra level of globbing.

In the kernel tree, try the difference between these two command lines:

	git ls-files fs/*.c
	
	git ls-files 'fs/*.c'

and enjoy.

It's _very_ useful for a number of programs (including "git add") but I 
find it _especially_ useful for something like

	git grep jiffies -- '*.h'

where the git-level globbign is important.

Not all git programs do that globbing, but many do.

Re: On removing files and "git-rm is pointless"

From: Sam Vilain <hidden>
Date: 2016-08-11 20:15:37

Horst H. von Brand wrote:
quoted
 - without "-r", don't do the partial matches at the beginning (but still 
   do globbing matches, of course, so "git rm dir/*" wouldn't need an 
   "-r", but "git rm -r dir/", which does the same thing, _would_ need an 
   "-r" to be effective)
The command should never even see the '*' here. Globbing is handled
(uniformly) by the shell. Don't loose that.
But;

  git-rm \*>/dev/null; git-add \*

is just so darned handy!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help