threads / patch / 26230

patchcommit: suggest --amend --reset-author to fix commiter identity

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

## tl;dr

10 messages between Jan 7, 2011 and Jan 12, 2011. Diffs are folded; open one to read it.

replies: 9people: 5as markdown or json

Matthieu Moy· Jan 7, 2011, 14:14 UTC · lore

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(-)
Show changes to builtin/commit.c +5 −1
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· Jan 7, 2011, 17:13 UTC · re: Matthieu Moy · lore

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

Matthieu Moy wrote:
Show 13 quoted lines
> --- 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· Jan 7, 2011, 17:16 UTC · re: Jonathan Nieder · lore

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

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· Jan 7, 2011, 17:34 UTC · re: Matthieu Moy · lore

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

Matthieu Moy wrote:
Show 12 quoted lines
> 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· Jan 7, 2011, 19:51 UTC · re: Matthieu Moy · lore

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

Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 23 quoted lines
> 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· Jan 8, 2011, 10:56 UTC · re: Junio C Hamano · lore

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

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 ;-).

Show 10 quoted lines
> 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· Jan 11, 2011, 05:34 UTC · re: Matthieu Moy · lore

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

On Sat, Jan 08, 2011 at 11:56:00AM +0100, Matthieu Moy wrote:
Show 13 quoted lines
> > 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· Jan 11, 2011, 14:07 UTC · re: Matthieu Moy · lore

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(-)
Show changes to builtin/commit.c +5 −1
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· Jan 12, 2011, 18:29 UTC · re: Matthieu Moy · lore

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

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(-)
Show changes to builtin/commit.c +2 −2
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· Jan 12, 2011, 18:39 UTC · re: Matthieu Moy · lore

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

On Wed, Jan 12, 2011 at 07:29:14PM +0100, Matthieu Moy wrote:
Show 11 quoted lines
> 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

← back to recent threads