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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 6, 2016, 15:22 UTC
Message-ID
<xmqqegaizrrr.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<vpqshyzw9u3.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 5 quoted lines
> 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 ...

More importntly, it would not be all that useful in practice. I can see "git log -p --author=me" might, but people usually go from what the code does and then figure out who wrote it, e.g. you try to see if there is already code that does something similar to what you want to do in the current codebase, and then run blame on the found block to see what commit brought it in if you want to avoid borrowing code from questionable parties, not the other way around.

One possible use case would be when you asked to produce a code sample for interviewing or something, but then "log --author=$me" may be a more effective way to find one. It would allow you to demonstrate not just the quality of code but also your ability to clearly explain your idea to others.

Previous: Matthieu Moy
Message 3 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.