git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] push: mention "git pull" in error message for non-fast forwards
@ 2010-08-02 13:42 Matthieu Moy
  2010-08-02 19:12 ` Jonathan Nieder
  2010-08-12 10:03 ` Matthieu Moy
  0 siblings, 2 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-08-02 13:42 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

The message remains fuzzy to include "git pull", "git pull --rebase" and
others, but directs the user to the simplest solution in the vast
majority of cases.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
When the message was added, it was decided explicitely not to say
explicitely "use git pull", first because there are other ways to
merge, and then to encourage the users to read the docs.

After a few months of teaching newbies/students to use Git, the
question "it doesn't want to push, what shall I do" still comes in the
top questions asked. Each time I've been asked, the newbie's face was
enlightened by hearing just the word "pull".

So I guess those few extra characters in the error message would save
me a lot of time ;-).

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

diff --git a/builtin/push.c b/builtin/push.c
index f4358b9..69bc2f2 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)
 
 	if (nonfastforward && advice_push_nonfastforward) {
 		fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
-				"Merge the remote changes before pushing again.  See the 'Note about\n"
-				"fast-forwards' section of 'git push --help' for details.\n");
+				"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n"
+				"'Note about fast-forwards' section of 'git push --help' for details.\n");
 	}
 
 	return 1;
-- 
1.7.2.1.28.g41d92

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-02 13:42 [PATCH] push: mention "git pull" in error message for non-fast forwards Matthieu Moy
@ 2010-08-02 19:12 ` Jonathan Nieder
  2010-08-02 19:52   ` Matthieu Moy
  2010-08-02 22:11   ` Junio C Hamano
  2010-08-12 10:03 ` Matthieu Moy
  1 sibling, 2 replies; 8+ messages in thread
From: Jonathan Nieder @ 2010-08-02 19:12 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, gitster

Hi Matthieu,

Matthieu Moy wrote:

> +++ b/builtin/push.c
> @@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)
>  
>  	if (nonfastforward && advice_push_nonfastforward) {
>  		fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
> -				"Merge the remote changes before pushing again.  See the 'Note about\n"
> -				"fast-forwards' section of 'git push --help' for details.\n");
> +				"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n"
> +				"'Note about fast-forwards' section of 'git push --help' for details.\n");

Your change is good.

This reminds me: sometimes people blindly “git pull” a rebased history
just to avoid a non-fast-forward push, and it irks me to no end.  So if
I were running the world, the output would be:

 error: rejected non-fast-forward push to '<url>'
 hint: To prevent you from losing history, non-fast-forward updates are
 hint: rejected by default.
 hint: See the 'Note about fast-forwards' section of 'git push --help'
 hint: for details.

and the relevant section of the manual would explain that

 1. if upstream is ahead of you, you may want to "git pull"

but

 2. if upstream rebased, you may want to "git pull --rebase", and
    yell at upstream a little while at it.

and

 3. if the history you are pushing to is both (1) known to be unstable
    and (2) wrong, you can override it with
    "git push <remote> +<refspec>".  Be sure to make sure the
    “[receive] denyNonFastForwards” setting is unset correctly in this
    case.

Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-02 19:12 ` Jonathan Nieder
@ 2010-08-02 19:52   ` Matthieu Moy
  2010-08-02 22:11   ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-08-02 19:52 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, gitster

Jonathan Nieder <jrnieder@gmail.com> writes:

> This reminds me: sometimes people blindly “git pull” a rebased history
> just to avoid a non-fast-forward push, and it irks me to no end.  So if
> I were running the world, the output would be:
>
>  error: rejected non-fast-forward push to '<url>'
>  hint: To prevent you from losing history, non-fast-forward updates are
>  hint: rejected by default.
>  hint: See the 'Note about fast-forwards' section of 'git push --help'
>  hint: for details.

If you were running the world, you'd still need to add stg like

   YES, I DO MEAN IT, RTFM BEFORE ANYTHING ELSE, AND DON'T COMPLAIN
   BEFORE YOU REACH THE END OF THE MANPAGE.

or so, at least if your friends look like my students ;-)

> and the relevant section of the manual would explain that
>
>  1. if upstream is ahead of you, you may want to "git pull"
>
> but
>
>  2. if upstream rebased, you may want to "git pull --rebase", and
>     yell at upstream a little while at it.
>
> and
>
>  3. if the history you are pushing to is both (1) known to be unstable
>     and (2) wrong, you can override it with
>     "git push <remote> +<refspec>".  Be sure to make sure the
>     “[receive] denyNonFastForwards” setting is unset correctly in this
>     case.

It's not that far from what the manpage says indeed (it talks about
--force instead of +<refspec>, and mentions both pull and pull
--rebase). But when the user reached the point where (s)he's wiling to
read the doc and finds it interesting, then (s)he'll also read about
advice.pushNonFastForward and get rid of the whole (now useless)
message ;-).

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-02 19:12 ` Jonathan Nieder
  2010-08-02 19:52   ` Matthieu Moy
@ 2010-08-02 22:11   ` Junio C Hamano
  2010-08-05 13:14     ` Matthieu Moy
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2010-08-02 22:11 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Matthieu Moy, git

Jonathan Nieder <jrnieder@gmail.com> writes:

> This reminds me: sometimes people blindly “git pull” a rebased history
> just to avoid a non-fast-forward push, and it irks me to no end.  So if
> I were running the world, the output would be:
>
>  error: rejected non-fast-forward push to '<url>'
>  hint: To prevent you from losing history, non-fast-forward updates are
>  hint: rejected by default.
>  hint: See the 'Note about fast-forwards' section of 'git push --help'
>  hint: for details.

I actually like that ;-)

Since we are discussing the "advice" part of the output, I don't think it
is so bad to add the three-bullet list below to it, either, though.

>  1. if upstream is ahead of you, you may want to "git pull"
>
> but
>
>  2. if upstream rebased, you may want to "git pull --rebase", and
>     yell at upstream a little while at it.
>
> and
>
>  3. if the history you are pushing to is both (1) known to be unstable
>     and (2) wrong, you can override it with
>     "git push <remote> +<refspec>".  Be sure to make sure the
>     “[receive] denyNonFastForwards” setting is unset correctly in this
>     case.
>
> Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-02 22:11   ` Junio C Hamano
@ 2010-08-05 13:14     ` Matthieu Moy
  0 siblings, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-08-05 13:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, git

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

> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> This reminds me: sometimes people blindly “git pull” a rebased history
>> just to avoid a non-fast-forward push, and it irks me to no end.  So if
>> I were running the world, the output would be:
>>
>>  error: rejected non-fast-forward push to '<url>'
>>  hint: To prevent you from losing history, non-fast-forward updates are
>>  hint: rejected by default.
>>  hint: See the 'Note about fast-forwards' section of 'git push --help'
>>  hint: for details.
>
> I actually like that ;-)
>
> Since we are discussing the "advice" part of the output, I don't think it
> is so bad to add the three-bullet list below to it, either, though.

The error message is one that a normal user can see relatively
regularly, as soon as he shares a bare-repository with co-workers, so
I think it should remain short. That's why I took great care to remain
within 3 lines in my patch.

Perhaps the manpage can be improved, but that's a separate topic. My
one-line patch would make a great improvement for beginners, without
harming advanced users, who still get the pointer to the doc.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-02 13:42 [PATCH] push: mention "git pull" in error message for non-fast forwards Matthieu Moy
  2010-08-02 19:12 ` Jonathan Nieder
@ 2010-08-12 10:03 ` Matthieu Moy
  2010-08-12 19:28   ` Jonathan Nieder
  2010-08-15 17:34   ` Matthieu Moy
  1 sibling, 2 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-08-12 10:03 UTC (permalink / raw)
  To: git; +Cc: gitster, Jonathan Nieder

Hi,

I'm sorry to insist, but nothing has happened to this patch, and I'd
really like it to get merged. The only reaction appart from Junio was
Jonathan, and althought it contained a disgression about "if I were
running the world", it started with "Your change is good." ;-).

Thanks,

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

> The message remains fuzzy to include "git pull", "git pull --rebase" and
> others, but directs the user to the simplest solution in the vast
> majority of cases.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> When the message was added, it was decided explicitely not to say
> explicitely "use git pull", first because there are other ways to
> merge, and then to encourage the users to read the docs.
>
> After a few months of teaching newbies/students to use Git, the
> question "it doesn't want to push, what shall I do" still comes in the
> top questions asked. Each time I've been asked, the newbie's face was
> enlightened by hearing just the word "pull".
>
> So I guess those few extra characters in the error message would save
> me a lot of time ;-).
>
>  builtin/push.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/push.c b/builtin/push.c
> index f4358b9..69bc2f2 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)
>  
>  	if (nonfastforward && advice_push_nonfastforward) {
>  		fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
> -				"Merge the remote changes before pushing again.  See the 'Note about\n"
> -				"fast-forwards' section of 'git push --help' for details.\n");
> +				"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n"
> +				"'Note about fast-forwards' section of 'git push --help' for details.\n");
>  	}
>  
>  	return 1;

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-12 10:03 ` Matthieu Moy
@ 2010-08-12 19:28   ` Jonathan Nieder
  2010-08-15 17:34   ` Matthieu Moy
  1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Nieder @ 2010-08-12 19:28 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, gitster

Matthieu Moy wrote:

> I'm sorry to insist, but nothing has happened to this patch, and I'd
> really like it to get merged. The only reaction appart from Junio was
> Jonathan, and althought it contained a disgression about "if I were
> running the world", it started with "Your change is good." ;-).

Indeed.  To be clear, I like your change. ;-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] push: mention "git pull" in error message for non-fast forwards
  2010-08-12 10:03 ` Matthieu Moy
  2010-08-12 19:28   ` Jonathan Nieder
@ 2010-08-15 17:34   ` Matthieu Moy
  1 sibling, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-08-15 17:34 UTC (permalink / raw)
  To: git; +Cc: gitster, Jonathan Nieder

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Hi,
>
> I'm sorry to insist, but nothing has happened to this patch, and I'd
> really like it to get merged. The only reaction appart from Junio was
> Jonathan, and althought it contained a disgression about "if I were
> running the world", it started with "Your change is good." ;-).

It got merged into master. Thanks, Junio!

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-15 17:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02 13:42 [PATCH] push: mention "git pull" in error message for non-fast forwards Matthieu Moy
2010-08-02 19:12 ` Jonathan Nieder
2010-08-02 19:52   ` Matthieu Moy
2010-08-02 22:11   ` Junio C Hamano
2010-08-05 13:14     ` Matthieu Moy
2010-08-12 10:03 ` Matthieu Moy
2010-08-12 19:28   ` Jonathan Nieder
2010-08-15 17:34   ` Matthieu Moy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).