Re: "commit --author=..." does not work if global email and name is not set
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 5, 2019, 08:11 UTC
- Message-ID
- <CAPc5daVQTouBVqJPccQNdzFP6XYEL7G2UUH-HC4QgYdRWt__Kw@mail.gmail.com>
- In-Reply-To
- <CAA01Csp7y9=2n9=TNYMMw9LUO_cENz7FBeZjFrUd2FvHFT9NCQ@mail.gmail.com>
On Fri, Apr 5, 2019 at 4:35 PM Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:
Show 7 quoted lines
> > Hi, > > 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@my.addre.ss commit ...
if you do not want to follow the advice message to store the ident permanently.
> git config --global user.email "you@example.com" > 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@my.addre.ss \ 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.