git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can `git grep` have `--Author` option?

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Apr 6, 2016, 06:05 UTC
Message-ID
<vpqshyzw9u3.fsf@anie.imag.fr>
In-Reply-To
<8737qztya5.fsf@gmail.com>
Chen Bin <chenbin.sh@gmail.com> writes:
Show 5 quoted lines
> This is a feature request.
>
> From time to time, I want to re-use MY code. So git grep with --Author
> options is really useful. My current git version is 2.6.3, looks it
> doesn't have this option.

Git doesn't "know" which line of code is yours. What it can do is walk through history to find out: this is "git blame", and you can already do "git blame | grep ...".

A "git grep --author" would need to blame all files before searching inside them, or grep first and blame each line in the result to filter out lines from the wrong author. That would be possible, but relatively hard to implement and painfully slow. Which probably explains why no one implemented it yet ...

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Chen BinNext: Junio C Hamano
Message 2 of 3 in “Can `git grep` have `--Author` option?”
  1. Chen BinApr 5, 2016
  2. Matthieu MoyApr 6, 2016
  3. Junio C HamanoApr 6, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.