On Fri, Apr 5, 2019 at 10:12 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > You can still do > > git -c user.name=me -c user.email=me@xxxxxxxxxxx commit ... [...] > GIT_COMMITTER_NAME=me GIT_COMMITTER_EMAIL=me@xxxxxxxxxxx \ > git commit --author=me ... > > even though it is not any shorter ;-). There are a couple of problems with this approach: 1. it's long, as you mentioned 2. it's easy to make a mistake - misspell name or address 3. you need to remember the options/variable names ("-c", user.name or GIT_COMMITER_NAME etc) - it's not user friendly If you make a mistake you end up with two different identities in history. Then e.g. searching for an author might not find all commits. On Mon, Apr 8, 2019 at 8:57 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Having slept on this a bit, I am of two minds here. > > It certainly is possible to change the rule to say that committer > identity, when not set at all, takes the default from the author > identity, if and only if the latter is explicitly given, and that > would certainly make it work as Piotr wanted to. Yes it would. But I understand your arguments too. Maybe instead of changing how "--author" works, we could add "--commiter" which works the same but for commiter, that is searches for committer in history? Then I could do "git commit --commiter=me". On the other hand this makes commiter somehow more important than author. The "author" is more obvious to users I think. When both author and commiter are the same, git shows the author only. In svn (and I think also in mercurial) there is only "author". So the first thought for users is "I should set the author", I believe. At least it was like that for me. From this point of view, I think the author should be more important. So I would prefer to be able to use "git commit --author=me" and have it work, instead of using "--commiter" which I believe is an implementation detail... I don't want to set the commiter, I want to set the author of the commit. So another possibility: add "--user=me" which would set both(?) author and commiter. I don't like that we would add another "idiom" ("author", "commiter", and now "user") but OTOH we already have "user.name" and "user.email" configuration names. > On Sat, Apr 6, 2019 at 8:25 PM Jakub Narebski <jnareb@xxxxxxxxx> wrote: > > Better though is to focus on what you want, namely to prevent accidental > > commits without specified author, instead of how you want to achieve it, > > i.e. using --author to provide both author and committer identity (the > > XY problem). On that machine with "automatic test account" set up > > pre-commit or commit-msg hook that fails if the GIT_AUTHOR_IDENT > > environment variable is not the "automatic test account". I'm not sure if I follow you. I want to be able to make both "real user" and "automatic test account user" commits from that machine. I want to make sure that: - automatic commits (scripts) use their own account - real person making commit uses their own account IMO the only way this can be achieved is by not having any default account setup, so that both the scripts and the real users need to specify it "by hand". -- Piotr Krukowiecki