From: Sam Ravnborg Date: Mon, 01 May 2006 14:04:10 GMT Subject: Re: [PATCH] built-in "git grep" (git grip). Message-ID: <20060501140410.GA3505@mars.ravnborg.org> In-Reply-To: <7v1wvetfuj.fsf@assigned-by-dhcp.cox.net> On Sun, Apr 30, 2006 at 11:32:36PM -0700, Junio C Hamano wrote: > This attempts to set up built-in "git grep" to further reduce > our dependence on the shell, while at the same time optionally > allowing to run grep against object database. You could do > funky things like these: > > git grep --cached -e pattern ;# grep from index > git grep -e pattern master ;# or in a rev > git grep -e pattern master next ;# or in multiple revs > git grep -e pattern pu^@ ;# even like this with an > ;# extension from another topic ;-) > git grep -e pattern master..next ;# or even from rev ranges > git grep -e pattern master~20:Documentation > ;# or an arbitrary tree > git grep -e pattern next:git-commit.sh > ;# or an arbitrary blob > A feature I have been missing often has been the possibility to limit grep (and ls-files) to certain filenames. Say: git grip -e DEBUG 'Kconfig*' I usually do something stupid like: git ls-files | grep Kconfig | xargs grep DEBUG Thought it may be trivial to extend git grip while you are there anyway. But obviously only if this is useful for more than just me. Sam