Re: git-grep to operate across who repository and not just CWD?
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Feb 28, 2011, 09:27 UTC
- Message-ID
- <4D6B6A8B.20709@drmicha.warpmail.net>
- In-Reply-To
- <AANLkTimnOSzF1o-fX-n7b26Qx2aLP3aU3pTMGY_f5hKy@mail.gmail.com>
David Chanters venit, vidit, dixit 28.02.2011 01:17:
Show 18 quoted lines
> Hi all,
>
> [ Please Cc me as I am not subscribed to this list, thanks. ]
>
> I'm wondering if there's an easy way to get git-grep (and I suppose
> other commands which operate on a per-repository level rather than
> per-tree) to work across the whole repository?
>
> Often I will be in the depths of my git repository, run "git grep
> --options 'search string'", to find no results. Of course, then I
> remember that git grep doesn't work across the whole repository, it
> works like normal grep, and only considers the CWD onwards.
> Typically I end up cursing, using {push,pop}d to recall where I am,
> cd'ing to the root of the repository and running "git grep" from there
> and then poping my CWD to go back to where I was.
>
> Is there some clever trickery or command-line flag I've not read about
> in the "git-grep" man page to make this idea more seamless?git grep -- $(git rev-parse --show-cdup)
is the best we have right now. I think we're still looking for a good way to denote "root of repo" (like "." for cwd).
Also, we're thinking of changing a few defaults (to repo-wide), but "git grep" is meant to stay close to ordinary grep.
Michael