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

Re: Inconsistent names in `git shortlog`

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 25, 2023, 00:40 UTC
Message-ID
<ZEchmO/7/KdLhsLg@tapette.crustytoothpaste.net>
In-Reply-To
<CAGeanHfxL9e_OHPFzBjLjgVU=QLvwYS9QVCGHC1JHSkApRAwgQ@mail.gmail.com>
On 2023-04-25 at 00:00:27, Blyxyas wrote:
Show 6 quoted lines
> `git shortlog` (specifically talking about `git shortlog -sn`, but
> applies to the whole subcommand) produces a list of names based on the
> contributors to a Git repository.
> But it turns out that the output of the shortlog is very inconsistent
> in that sometimes it uses the username and other times the full name.
> This can happen even in the same repo.

I don't think `git shortlog` considers anything but what's in the author name field, as far as I can tell. It may be that some people have placed a username in that field, which is contrary to the intention that it be a personal name, but we can't force people to use a particular name.

git-commit(1) documents this:
  The author and committer names are by convention some form of a
  personal name (that is, the name by which other humans refer to you),
  although Git does not enforce or require any particular form.
  Arbitrary Unicode may be used, subject to the constraints listed above
  [which I have elided here]. This name has no effect on authentication;
  for that, see the credential.username variable in git-config(1).

I added this documentation because many people _do_ think it has something to do with authentication and thus put a username there under that mistaken impression. I suspect that's what's happened in the situation you mention.

Show 5 quoted lines
> There should be a convention established. I would personally prefer
> using usernames, as the huge impact of Github would mean that it's
> easier to go to their profile just by copy-pasting their shortlog
> name. Maybe add a `--realname` / `-r` flag to the command to show the
> real names and show usernames by default?

There are many Git users who don't use GitHub, and the documented intention is that it be a personal name, so I'd recommend that people use that. Regardless, we don't know what a person's GitHub username is or if they have one, and Git wouldn't want to prioritize one particular forge over another, so we wouldn't add any sort of API requests to GitHub in particular.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: BlyxyasNext: Jeff King
Message 2 of 4 in “Inconsistent names in `git shortlog`”
  1. BlyxyasApr 25, 2023
  2. brian m. carlsonApr 25, 2023
  3. Jeff KingApr 25, 2023
  4. Junio C HamanoApr 25, 2023

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.