Re: [PATCH] commit: add --committer option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 10, 2025, 22:06 UTC
- Message-ID
- <xmqq8qgdzgng.fsf@gitster.g>
- In-Reply-To
- <20251110201136.GB127132@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> Is a "--committer" option the best solution there, though? I'd think > you'd want to set user.* in the repo-level .git/config (or using a > dir-specific include) would be less error-prone. > > That doesn't help for using two identities for the same repo, but in my > experience it is easier to use two separate repositories for that to > match the organization of the work (even if you may sometimes fetch > between them).
This happens to match my experience, but my use case may be rather skewed. The two sets of contents managed by my two clones that push into the same repository (of course to two different branches) are rather disjoint and they never merge into each other (in fact they do not even share the root commit).
If you are working under two identities on the same codebase, I would imagine that two repo arrangement may be more cumbersome than working in a single repository and switching between the identities, and may be preferrable as long as you are confident that you won't commit a change under the "other" (wrong) identity. Of course, your reflogs and notes would also follow the "then-current" committer identity, so if I were to flip between two identities while working on the same codebase in a single repository, I am very likely to export GIT_{AUTHOR,COMMITTER}_* environment variables, dedicate that shell/window to the work done under that identity, and switch the environment variables if/when I want to switch (or have another shell/window with the other identities exported---perhaps I'd do that in a secondary worktree). I cannot imagine myself keep giving --author and --committer between my two identities without mistakes.
> I'm not totally opposed to the new flag, and in general I'd defer to > people who say they find a new feature useful. I'm just having a hard > time imagining a scenario where it's the best option.
Same here. The "give them long enough rope" principle tells me that this may be worth having if even only to have symmetry with existing "--author" option, but these two are not inherently symmetric to begin with, and I am not sure if there is a scenario in which this new option is the best thing to use.