Subject: Re: [PATCH] commit: add --committer option

From: Jeff King <[email-masked]>
Date: Tue, 11 Nov 2025 16:33:39 -0500

On Tue, Nov 11, 2025 at 12:16:40PM -0800, Junio C Hamano wrote:

> Jeff King <[email-masked]> writes:
> 
> >> Sometimes it's because I forgot to configure the repository-level git user
> >> config and started development first. Only when I tried to correct the
> >> committer did I feel the pain.
> >
> > OK, this workflow does make sense to me. Fixing up an earlier mistake is
> > inherently a one-off thing, and a command-line option is more ergonomic
> > than using the environment variables.
> 
> Not very much, at least to me.  Fixing up an earlier mistake may be
> one-shot thing but it is to correct multiple commits in one go,
> which would be error prone if you do so with "git commit --option".
> Either "fast-export | fast-import" pipe, or "git rebase" (which this
> patch does not give --committer option, but it already knows how to
> honor existing environment variables) would be used for that, no?

I usually lean on "commit --amend" for this, coupled with rebase if
there are multiple commits. So I've used:

  git rebase -x "git commit --no-edit --amend --author=..."
 
or similar when fixing up incorrect application of somebody else's
patches (e.g., if I ended up using "git apply" and tweaking the commit
message myself, rather than using "git am").

> > Two small thoughts:
> >
> >   - I suspect what you'd usually want there is for the committer and the
> >     author to match. We have --committer-date-is-author-date for rebase,
> >     and conceptually I think something like --committer-is-author would
> >     do what you want here. But obviously it's less flexible, and I don't
> >     know if it's that much easier to use.
> 
> I am not sure how the user experience of this would look like.

I just mean being able to do:

  git commit --amend --author='Foo Bar <[email-masked]>' --committer-is-author

instead of:

  git commit --amend --author='Foo Bar <[email-masked]>' --committer='Foo Bar <[email-masked]>'

-Peff