Re: "commit --author=..." does not work if global email and name is not set
- Date: Fri, 5 Apr 2019 17:11:48 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: "commit --author=..." does not work if global email and name is not set
On Fri, Apr 5, 2019 at 4:35 PM Piotr Krukowiecki
> I have a repo downloaded on machines which do automatic tests.
> Sometimes I want to make a quick fix there and push back to origin.
> Reading git-commit docs I had impression that I can use "--author=me"
> and it will work. But it requires setting global user name and email:
You can still do
git -c user.name=me -c user.email=me@xxxxxxxxxxx commit ...
if you do not want to follow the advice message to store the ident
> git config --global user.email "you@xxxxxxxxxxx"
> git config --global user.name "Your Name"
Technically, what you are missing when you give --author is only
the committer ident, so you can probably use
GIT_COMMITTER_NAME=me GIT_COMMITTER_EMAIL=me@xxxxxxxxxxx \
git commit --author=me ...
even though it is not any shorter ;-).
I think all of the above is quite expected. The fact that --author is used to
specify the ident of the author is a good sign that it is different from the
committer ident (otherwise the user would be using a configured default
ident that is always used as the committer ident, without overriding it
with the --author) option.