threads / discuss / 40707

git log --author=me

Subject: git log --author=me

## tl;dr

7 messages between Nov 2, 2015 and Nov 3, 2015.

replies: 6people: 6as markdown or json

Harry Jeffery· Nov 2, 2015, 13:27 UTC · lore
Hi,

I've written a patch that allows `me` to be used as shorthand for $(user.name) or $(user.email) in the `--author` and `--commiter` fields.

The purpose being to make finding your own commits quicker and easier:
     git log --author=me

Is this a change that would be accepted if submitted? The only thing it's currently missing is unit tests.

Regards, Harry

Andreas Schwab· Nov 2, 2015, 17:50 UTC · re: Harry Jeffery · lore

Re: git log --author=me

Harry Jeffery <harry@exec64.co.uk> writes:
> The purpose being to make finding your own commits quicker and easier:
>     git log --author=me

Since --author does a regexp search, this would most likely break someone's searches. Better add a new option for that functionality.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Junio C Hamano· Nov 2, 2015, 18:05 UTC · re: Andreas Schwab · lore

Re: git log --author=me

Andreas Schwab <schwab@linux-m68k.org> writes:
Show 7 quoted lines
> Harry Jeffery <harry@exec64.co.uk> writes:
>
>> The purpose being to make finding your own commits quicker and easier:
>>     git log --author=me
>
> Since --author does a regexp search, this would most likely break
> someone's searches.  Better add a new option for that functionality.

I do not think it would hurt too much to add "--mine" to look for "--author" that matches you, but on the other hand, I am not sure its value outweighs the additional noise in the manual page.

It certainly does not help "I have done this much to this project in the time period, and you can look at the output of this command yourself to verify my claim. Type 'git shortlog --mine' and then promote me this season, please!" use case ;-)

So...
Matthieu Moy· Nov 2, 2015, 18:24 UTC · re: Junio C Hamano · lore

Re: git log --author=me

Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Harry Jeffery <harry@exec64.co.uk> writes:
>>
>>> The purpose being to make finding your own commits quicker and easier:
>>>     git log --author=me
>>
>> Since --author does a regexp search, this would most likely break
>> someone's searches.  Better add a new option for that functionality.
>
> I do not think it would hurt too much to add "--mine" to look for
> "--author" that matches you, but on the other hand, I am not sure
> its value outweighs the additional noise in the manual page.

I have a few aliases to congratulate myself for being such an awesome contributor from time to time ;-):

[alias]
	mymaster = log --oneline --author=Matthieu.Moy@imag.fr origin/master

It did require me to write these lines in my config file, but I think that the trouble of writing them is smaller than the extra noise in the manual page and possibly the output of `git log -h`. Having the shorthand "--author=me" would be better than "git log --mine" as far as cluttering the doc is concerned IMHO, but it's also likely to break someone's search.

BTW, the output of `git log -h` is disappointing:
    $ git log -h
    usage: git log [<options>] [<revision-range>] [[--] <path>...]
       or: git show [<options>] <object>...
    
        -q, --quiet           suppress diff output
        --source              show source
        --use-mailmap         Use mail map file
        --decorate[=...]      decorate options
        -L <n,m:file>         Process line range n,m in file, counting from 1
    
There are far more options than this...
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Duy Nguyen· Nov 2, 2015, 18:37 UTC · re: Harry Jeffery · lore

Re: git log --author=me

On Mon, Nov 2, 2015 at 2:27 PM, Harry Jeffery <harry@exec64.co.uk> wrote:
Show 8 quoted lines
> Hi,
>
> I've written a patch that allows `me` to be used as shorthand for
> $(user.name) or $(user.email) in the `--author` and `--commiter` fields.
>
> The purpose being to make finding your own commits quicker and easier:
>     git log --author=me
>

It would be even cooler if it accepts mail aliases, then you can define "me" to your address and also have shortcuts to a few of your best friends. Though as Andreas pointed out --author is not a good fit because it accepts regex, and you can't use --mine either, so more work..

-- 
Duy
Michael J Gruber· Nov 3, 2015, 10:26 UTC · re: Duy Nguyen · lore

Re: git log --author=me

Duy Nguyen venit, vidit, dixit 02.11.2015 19:37:
Show 16 quoted lines
> On Mon, Nov 2, 2015 at 2:27 PM, Harry Jeffery <harry@exec64.co.uk> wrote:
>> Hi,
>>
>> I've written a patch that allows `me` to be used as shorthand for
>> $(user.name) or $(user.email) in the `--author` and `--commiter` fields.
>>
>> The purpose being to make finding your own commits quicker and easier:
>>     git log --author=me
>>
> 
> It would be even cooler if it accepts mail aliases, then you can
> define "me" to your address and also have shortcuts to a few of your
> best friends. Though as Andreas pointed out --author is not a good fit
> because it accepts regex, and you can't use --mine either, so more
> work..
> 
Alternatively: How about teaching git-completion to complete the
argument to --author? Expensive, I know, but faster than typing it out
or realising "Michael J" is not as unique as you think ;)
Michael
Junio C Hamano· Nov 3, 2015, 21:30 UTC · re: Michael J Gruber · lore

Re: git log --author=me

Michael J Gruber <git@drmicha.warpmail.net> writes:
> Alternatively: How about teaching git-completion to complete the
> argument to --author? Expensive, I know, but faster than typing it out
> or realising "Michael J" is not as unique as you think ;)
Or
    $ git log --author="$me"
with
    me='Michael J Gruber <git@drmicha.warpmail.net>'
in your $HOME/.profile or somewhere?

I personally would find "--author=me" not so bad (especially if finding _my_ work were a very important workflow element), and I may even tell people to do

    $ git log --author='[m]e'
if they want to find anybody with substring 'me' in their ident.

But that is only if it weren't for existing users, and we live in an imperfect world where we seem to have many of existing users already.

← back to recent threads