How to get the “committer” info that Git will use

Reading the doc, I see that I could predict what Git will use as “committer” by combining git config user.name and git config user.email along with $GIT_COMMITTER_NAME and $GIT_COMMITTER_EMAIL. But when I write the code which does that, I end up with the feeling that I’m rewriting a chunk of code that’s already in Git and I’d much rather reuse Git’s own code for that.

So, just like I prefer to use git rev-parse --git-dir rather than to look for a .git and/or check for $GIT_DIR, I’d like to use a command like git show-me-the --committer to get the usual NAME <EMAIL> string. Yet I haven’t been able to find this in the manual(s).

  • Detecting conflict on git rebase
  • Need a strategy to put Intellij IDEA project files in Git
  • `hub` pull-request for organization repository
  • Does git de-duplicate between files?
  • Change Git repository download path on Mac
  • First time using node.js - “ReferenceError: node is not defined”
  • Git command to get HEAD SHA1 with “-dirty” suffix if workspace is not clean
  • Fastest way to get git status in bash
  • Commits since a certain commit number
  • git: How do you check out the initial version of a file in a git repo
  • capistrano rails 3 git error - fatal: Not a git repository (or any of the parent directories): .git
  • git-shell equivalent of svnserve -r?
  • One Solution collect form web for “How to get the “committer” info that Git will use”

    You can use the git var command:

    git var GIT_COMMITTER_IDENT
    

    This can be run outside of any Git worktree, prints the committer info in the format name <email> timestamp timezone, and uses the same Git code that also gets run when committing, so respects the configuration keys and environment variables. Depending on what you want to do with this info, you may need to filter out the timestamp and timezone.

    Git Baby is a git and github fan, let's start git clone.