git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Glen Peterson <glen.k.peterson@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: `git commit` with the `--author` option
Date: Fri, 14 Jan 2022 20:38:30 +0000	[thread overview]
Message-ID: <YeHfRguxRI6wNwvg@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CA+LnoU=MwKiyY6+MUWUj=SpgGrg2RVabNY_vtBbBicAsW2ZzjA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]

Hey,

On 2022-01-14 at 20:24:58, Glen Peterson wrote:
> Thank you for git!  I use it hourly.  It is orders of magnitude better
> than vcs, cvs, subversion, clearquest, sourcesafe, and a number of
> others I have used, but can't remember right now.

I'm glad you're happy with it.  We always like to hear good news.

> I was excited to see the `--author` option on the `git commit`
> command, thinking that I could use it to set arbitrary authors for git
> commits.  Reading the docs, I expected to use it to, "Specify an
> explicit author using the standard A U Thor _author@example.com_
> format."
> 
> It seems from stackoverflow and this list that git won't do that
> unless you have an author specified in your config somewhere (`git
> config user.email` and `git config user.name`)?  Links to sources
> available on request (your system rejected my first email).
> 
> Does the email you set in the `--author` option have to match the one
> in your config, or can you set it to anything once you have a random
> user.email in your config?  Is this option just for choosing between
> pre-configured emails?

The --author option does set the author, and it should contain a
personal name and email in the typical format.  It can contain any entry
you want, whether or not it's set in the config, provided it meets the
syntax requirement.

> I think this option would be much more useful if it worked without
> also setting your git config.

Creating a commit also requires that you specify a committer.  Since
there's no option for that, you'll need to either have it come from the
config, or use the GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL
environment variables to specify the committer information.  There are
similar GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, which are useful to set if
you're working in a script.

You can also use the -c option to specify that config, like so:

  git -c committer.name="Pat Doe" -c committer.email="doe@example.com" commit

There are even more ways you can get this information, and the
git-commit(1) manual page outlines them in detail.  If you think that
documentation is lacking, please let us know, and I'll try to get an
improvement in when I next get a chance.

I agree that a --committer option would also be a nice improvement here,
though, since this seems to be a thing people want, especially for
scripting.  If there are other use cases you're thinking of that aren't
scripting related or that we haven't considered, please share more, and
we'll see if we can accommodate them.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

      reply	other threads:[~2022-01-14 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 20:24 `git commit` with the `--author` option Glen Peterson
2022-01-14 20:38 ` brian m. carlson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YeHfRguxRI6wNwvg@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=glen.k.peterson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).