# [PATCH] commit: suggest --amend --reset-author to fix commiter identity

10 messages from 2011-01-07 to 2011-01-12. Participants: Matthieu Moy, Jonathan Nieder, Junio C Hamano, Jeff King.
Thread: https://gitlist.dev/t/26230

## Matthieu Moy, 2011-01-07 14:14

Subject: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <1294409671-5479-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1294409671-5479-1-git-send-email-Matthieu.Moy%40imag.fr

```
The advantage of this command is that it is cut-and-paste ready, while
using --author='...' requires the user to type his name and email a
second time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin/commit.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 22ba54f..440223c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -47,7 +47,11 @@ static const char implicit_ident_advice[] =
 "\n"
 "If the identity used for this commit is wrong, you can fix it with:\n"
 "\n"
-"    git commit --amend --author='Your Name <you@example.com>'\n";
+"    git commit --amend --author='Your Name <you@example.com>'\n"
+"\n"
+"or\n"
+"\n"
+"    git commit --amend --reset-author\n";
 
 static const char empty_amend_advice[] =
 "You asked to amend the most recent commit, but doing so would make\n"
-- 
1.7.4.rc0.1.g6944b.dirty

```

## Jonathan Nieder, 2011-01-07 17:13

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <20110107171329.GA16571@burratino>
URL: https://gitlist.dev/e/20110107171329.GA16571%40burratino
In-Reply-To: <1294409671-5479-1-git-send-email-Matthieu.Moy@imag.fr>

```
Matthieu Moy wrote:

> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -47,7 +47,11 @@ static const char implicit_ident_advice[] =
>  "\n"
>  "If the identity used for this commit is wrong, you can fix it with:\n"
>  "\n"
> -"    git commit --amend --author='Your Name <you@example.com>'\n";
> +"    git commit --amend --author='Your Name <you@example.com>'\n"
> +"\n"
> +"or\n"
> +"\n"
> +"    git commit --amend --reset-author\n";
>

This message gets used when the author was set from gecos because
not available in the configuration.  Do you perhaps mean:

	If the identity used for this commit is wrong, you can fix it with:

	    git commit --amend --author='Your Name <you@example.com>'
	    git commit --amend --author='Your Name <you@example.com>'

	or

	    cat <<EOF >>~/.gitconfig
	    [user]
	      name = Your Name
	      email = you@example.com
	    EOF
	    git commit --amend --reset-author

?

```

## Matthieu Moy, 2011-01-07 17:16

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <vpq7hegmy66.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpq7hegmy66.fsf%40bauges.imag.fr
In-Reply-To: <20110107171329.GA16571@burratino>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> This message gets used when the author was set from gecos because
> not available in the configuration.

The complete message says:

"Your name and email address were configured automatically based\n"
"on your username and hostname. Please check that they are accurate.\n"
"You can suppress this message by setting them explicitly:\n"
"\n"
"    git config --global user.name \"Your Name\"\n"
"    git config --global user.email you@example.com\n"
"\n"
"If the identity used for this commit is wrong, you can fix it with:\n"
"\n"
"    git commit --amend --author='Your Name <you@example.com>'\n"
"\n"
"or\n"
"\n"
"    git commit --amend --reset-author\n";

So, the natural thing to do is

git config --global user.name "me"
git config --global user.email "my.email@bla.com"
git commit --amend --reset-author

and it's not necessary to use the longer

git config --global user.name "me"
git config --global user.email "my.email@bla.com"
git commit --amend --author='me <my.email@bla.com>'

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jonathan Nieder, 2011-01-07 17:34

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <20110107173428.GC16571@burratino>
URL: https://gitlist.dev/e/20110107173428.GC16571%40burratino
In-Reply-To: <vpq7hegmy66.fsf@bauges.imag.fr>

```
Matthieu Moy wrote:

> The complete message says:
> 
> "Your name and email address were configured automatically based\n"
> "on your username and hostname. Please check that they are accurate.\n"
> "You can suppress this message by setting them explicitly:\n"
> "\n"
> "    git config --global user.name \"Your Name\"\n"
> "    git config --global user.email you@example.com\n"
> "\n"
> "If the identity used for this commit is wrong, you can fix it with:\n"
> "\n"
> "    git commit --amend --author='Your Name <you@example.com>'\n"

Sloppy reading on my part.  So the original text explains:

	how to configure your identity globally
	how to change the identity for a single commit

> "\n"
> "or\n"
> "\n"
> "    git commit --amend --reset-author\n";

Maybe:

	If the identity used for this commit is wrong, you can fix it:

	    git commit --amend --author='Patch Submitter <author@example.com>'

	To just use your newly configured identity:

	    git commit --amend --reset-author

(modulo wording).  The idea being to make it clear to the user why we
are telling two ways to do the same thing.

Sorry for the nonsense.
Jonathan

```

## Junio C Hamano, 2011-01-07 19:51

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <7vsjx45w7g.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsjx45w7g.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1294409671-5479-1-git-send-email-Matthieu.Moy@imag.fr>

```
Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> The advantage of this command is that it is cut-and-paste ready, while
> using --author='...' requires the user to type his name and email a
> second time.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>  builtin/commit.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 22ba54f..440223c 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -47,7 +47,11 @@ static const char implicit_ident_advice[] =
>  "\n"
>  "If the identity used for this commit is wrong, you can fix it with:\n"
>  "\n"
> -"    git commit --amend --author='Your Name <you@example.com>'\n";
> +"    git commit --amend --author='Your Name <you@example.com>'\n"
> +"\n"
> +"or\n"
> +"\n"
> +"    git commit --amend --reset-author\n";

I don't think making the "cheat-sheet" insn longer by offering more
choices is a good idea.  These are messages for lazy and busy people.

Wouldn't it work better to just get rid of the longer form and say
something like:

    ... here is how to tell your name to git (existing message) ...

    After doing the above, run

    	git commit --amend --reset-author

    to fix the identity used for this commit.

```

## Matthieu Moy, 2011-01-08 10:56

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <vpq1v4nirzz.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpq1v4nirzz.fsf%40bauges.imag.fr
In-Reply-To: <7vsjx45w7g.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> I don't think making the "cheat-sheet" insn longer by offering more
> choices is a good idea.  These are messages for lazy and busy
> people.

The reason I kept both forms was that the message is designed to be
seen once (or once for each new machine one works on), and the most
scary it is, the most efficient ;-). 

> Wouldn't it work better to just get rid of the longer form and say
> something like:
>
>     ... here is how to tell your name to git (existing message) ...
>
>     After doing the above, run
>
>     	git commit --amend --reset-author
>
>     to fix the identity used for this commit.

I'm fine with that proposal too. I'll resend with that if no one
objects. Probalby rewording it to

After doing this, you can fix the identity used for this commit with:

  git commit --amend --reset-author


would make it even concisier (no break of the sentence with a
command).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jeff King, 2011-01-11 05:34

Subject: Re: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <20110111053451.GA10094@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110111053451.GA10094%40sigill.intra.peff.net
In-Reply-To: <vpq1v4nirzz.fsf@bauges.imag.fr>

```
On Sat, Jan 08, 2011 at 11:56:00AM +0100, Matthieu Moy wrote:

> > Wouldn't it work better to just get rid of the longer form and say
> > something like:
> >
> >     ... here is how to tell your name to git (existing message) ...
> >
> >     After doing the above, run
> >
> >     	git commit --amend --reset-author
> >
> >     to fix the identity used for this commit.
> 
> I'm fine with that proposal too. I'll resend with that if no one
> objects. Probalby rewording it to

Hmm.  When I originally wrote that message, I specifically avoided using
--reset-author because I figured people would want to most immediately
fix the broken commit, and then maybe would not be too lazy to fix
things for the future. But that was just a hunch, and I don't feel
strongly about it.

I was also afraid of people blindly running the fixup command without
doing the configuration specified in the commands above. However, I
think as long as the text makes it clear that one depends on the other,
it should be OK. So something like:

> After doing this, you can fix the identity used for this commit with:
> 
>   git commit --amend --reset-author

looks fine to me.

-Peff

```

## Matthieu Moy, 2011-01-11 14:07

Subject: [PATCH] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <1294754860-17701-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1294754860-17701-1-git-send-email-Matthieu.Moy%40imag.fr
In-Reply-To: <vpq1v4nirzz.fsf@bauges.imag.fr>

```
Since the message advise to fix the configuration first, the advantage
of this command is that it is cut-and-paste ready, while using
--author='...' requires the user to type his name and email a second
time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin/commit.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 22ba54f..440223c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -47,7 +47,11 @@ static const char implicit_ident_advice[] =
 "\n"
 "If the identity used for this commit is wrong, you can fix it with:\n"
 "\n"
-"    git commit --amend --author='Your Name <you@example.com>'\n";
+"    git commit --amend --author='Your Name <you@example.com>'\n"
+"\n"
+"or\n"
+"\n"
+"    git commit --amend --reset-author\n";
 
 static const char empty_amend_advice[] =
 "You asked to amend the most recent commit, but doing so would make\n"
-- 
1.7.4.rc0.2.g3e22c.dirty

```

## Matthieu Moy, 2011-01-12 18:29

Subject: [PATCH v2] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <1294856954-26841-1-git-send-email-Matthieu.Moy@imag.fr>
URL: https://gitlist.dev/e/1294856954-26841-1-git-send-email-Matthieu.Moy%40imag.fr
In-Reply-To: <1294754860-17701-1-git-send-email-Matthieu.Moy@imag.fr>

```
Since the message advise to fix the configuration first, the advantage
of this command is that it is cut-and-paste ready, while using
--author='...' requires the user to type his name and email a second
time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Sorry, I did a resend the other day, which was plain wrong (I had the
changes in my tree, but sent before commit--amend-ing).

This one should be OK.

 builtin/commit.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 22ba54f..03cff5a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -45,9 +45,9 @@ static const char implicit_ident_advice[] =
 "    git config --global user.name \"Your Name\"\n"
 "    git config --global user.email you@example.com\n"
 "\n"
-"If the identity used for this commit is wrong, you can fix it with:\n"
+"After doing this, you may fix the identity used for this commit with:\n"
 "\n"
-"    git commit --amend --author='Your Name <you@example.com>'\n";
+"    git commit --amend --reset-author\n";
 
 static const char empty_amend_advice[] =
 "You asked to amend the most recent commit, but doing so would make\n"
-- 
1.7.4.rc0.2.g3e22c.dirty

```

## Jeff King, 2011-01-12 18:39

Subject: Re: [PATCH v2] commit: suggest --amend --reset-author to fix commiter identity
Message-ID: <20110112183904.GE31747@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110112183904.GE31747%40sigill.intra.peff.net
In-Reply-To: <1294856954-26841-1-git-send-email-Matthieu.Moy@imag.fr>

```
On Wed, Jan 12, 2011 at 07:29:14PM +0100, Matthieu Moy wrote:

> Since the message advise to fix the configuration first, the advantage
> of this command is that it is cut-and-paste ready, while using
> --author='...' requires the user to type his name and email a second
> time.
> 
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> Sorry, I did a resend the other day, which was plain wrong (I had the
> changes in my tree, but sent before commit--amend-ing).
> 
> This one should be OK.

Yeah, this one looks good.

Acked-by: Jeff King <peff@peff.net>

-Peff

```
