{"thread":{"id":"24602","subject":"[PATCH] push: mention \"git pull\" in error message for non-fast forwards","startedAt":"2010-08-02T13:42:44Z","lastAt":"2010-08-15T17:34:14Z","messageCount":8,"participants":["Matthieu Moy","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"146943","messageId":"1280756564-3932-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"24602","inReplyTo":null,"subject":"[PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2010-08-02T13:42:44Z","receivedAt":"2010-08-02T13:42:44Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The message remains fuzzy to include \"git pull\", \"git pull --rebase\" and\nothers, but directs the user to the simplest solution in the vast\nmajority of cases.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nWhen the message was added, it was decided explicitely not to say\nexplicitely \"use git pull\", first because there are other ways to\nmerge, and then to encourage the users to read the docs.\n\nAfter a few months of teaching newbies/students to use Git, the\nquestion \"it doesn't want to push, what shall I do\" still comes in the\ntop questions asked. Each time I've been asked, the newbie's face was\nenlightened by hearing just the word \"pull\".\n\nSo I guess those few extra characters in the error message would save\nme a lot of time ;-).\n\n builtin/push.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/push.c b/builtin/push.c\nindex f4358b9..69bc2f2 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)\n \n \tif (nonfastforward && advice_push_nonfastforward) {\n \t\tfprintf(stderr, \"To prevent you from losing history, non-fast-forward updates were rejected\\n\"\n-\t\t\t\t\"Merge the remote changes before pushing again.  See the 'Note about\\n\"\n-\t\t\t\t\"fast-forwards' section of 'git push --help' for details.\\n\");\n+\t\t\t\t\"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\\n\"\n+\t\t\t\t\"'Note about fast-forwards' section of 'git push --help' for details.\\n\");\n \t}\n \n \treturn 1;\n-- \n1.7.2.1.28.g41d92\n"},{"id":"146974","messageId":"20100802191211.GA2180@burratino","threadId":"24602","inReplyTo":"1280756564-3932-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-02T19:12:49Z","receivedAt":"2010-08-02T19:12:49Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Matthieu,\n\nMatthieu Moy wrote:\n\n> +++ b/builtin/push.c\n> @@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)\n>  \n>  \tif (nonfastforward && advice_push_nonfastforward) {\n>  \t\tfprintf(stderr, \"To prevent you from losing history, non-fast-forward updates were rejected\\n\"\n> -\t\t\t\t\"Merge the remote changes before pushing again.  See the 'Note about\\n\"\n> -\t\t\t\t\"fast-forwards' section of 'git push --help' for details.\\n\");\n> +\t\t\t\t\"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\\n\"\n> +\t\t\t\t\"'Note about fast-forwards' section of 'git push --help' for details.\\n\");\n\nYour change is good.\n\nThis reminds me: sometimes people blindly “git pull” a rebased history\njust to avoid a non-fast-forward push, and it irks me to no end.  So if\nI were running the world, the output would be:\n\n error: rejected non-fast-forward push to '<url>'\n hint: To prevent you from losing history, non-fast-forward updates are\n hint: rejected by default.\n hint: See the 'Note about fast-forwards' section of 'git push --help'\n hint: for details.\n\nand the relevant section of the manual would explain that\n\n 1. if upstream is ahead of you, you may want to \"git pull\"\n\nbut\n\n 2. if upstream rebased, you may want to \"git pull --rebase\", and\n    yell at upstream a little while at it.\n\nand\n\n 3. if the history you are pushing to is both (1) known to be unstable\n    and (2) wrong, you can override it with\n    \"git push <remote> +<refspec>\".  Be sure to make sure the\n    “[receive] denyNonFastForwards” setting is unset correctly in this\n    case.\n\nJonathan\n"},{"id":"146978","messageId":"vpqfwywdc7j.fsf@bauges.imag.fr","threadId":"24602","inReplyTo":"20100802191211.GA2180@burratino","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-08-02T19:52:16Z","receivedAt":"2010-08-02T19:52:16Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> This reminds me: sometimes people blindly “git pull” a rebased history\n> just to avoid a non-fast-forward push, and it irks me to no end.  So if\n> I were running the world, the output would be:\n>\n>  error: rejected non-fast-forward push to '<url>'\n>  hint: To prevent you from losing history, non-fast-forward updates are\n>  hint: rejected by default.\n>  hint: See the 'Note about fast-forwards' section of 'git push --help'\n>  hint: for details.\n\nIf you were running the world, you'd still need to add stg like\n\n   YES, I DO MEAN IT, RTFM BEFORE ANYTHING ELSE, AND DON'T COMPLAIN\n   BEFORE YOU REACH THE END OF THE MANPAGE.\n\nor so, at least if your friends look like my students ;-)\n\n> and the relevant section of the manual would explain that\n>\n>  1. if upstream is ahead of you, you may want to \"git pull\"\n>\n> but\n>\n>  2. if upstream rebased, you may want to \"git pull --rebase\", and\n>     yell at upstream a little while at it.\n>\n> and\n>\n>  3. if the history you are pushing to is both (1) known to be unstable\n>     and (2) wrong, you can override it with\n>     \"git push <remote> +<refspec>\".  Be sure to make sure the\n>     “[receive] denyNonFastForwards” setting is unset correctly in this\n>     case.\n\nIt's not that far from what the manpage says indeed (it talks about\n--force instead of +<refspec>, and mentions both pull and pull\n--rebase). But when the user reached the point where (s)he's wiling to\nread the doc and finds it interesting, then (s)he'll also read about\nadvice.pushNonFastForward and get rid of the whole (now useless)\nmessage ;-).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"147003","messageId":"7vfwywk6lr.fsf@alter.siamese.dyndns.org","threadId":"24602","inReplyTo":"20100802191211.GA2180@burratino","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-02T22:11:28Z","receivedAt":"2010-08-02T22:11:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> This reminds me: sometimes people blindly “git pull” a rebased history\n> just to avoid a non-fast-forward push, and it irks me to no end.  So if\n> I were running the world, the output would be:\n>\n>  error: rejected non-fast-forward push to '<url>'\n>  hint: To prevent you from losing history, non-fast-forward updates are\n>  hint: rejected by default.\n>  hint: See the 'Note about fast-forwards' section of 'git push --help'\n>  hint: for details.\n\nI actually like that ;-)\n\nSince we are discussing the \"advice\" part of the output, I don't think it\nis so bad to add the three-bullet list below to it, either, though.\n\n>  1. if upstream is ahead of you, you may want to \"git pull\"\n>\n> but\n>\n>  2. if upstream rebased, you may want to \"git pull --rebase\", and\n>     yell at upstream a little while at it.\n>\n> and\n>\n>  3. if the history you are pushing to is both (1) known to be unstable\n>     and (2) wrong, you can override it with\n>     \"git push <remote> +<refspec>\".  Be sure to make sure the\n>     “[receive] denyNonFastForwards” setting is unset correctly in this\n>     case.\n>\n> Jonathan\n"},{"id":"147190","messageId":"vpqiq3pp5gk.fsf@bauges.imag.fr","threadId":"24602","inReplyTo":"7vfwywk6lr.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-08-05T13:14:03Z","receivedAt":"2010-08-05T13:14:03Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> This reminds me: sometimes people blindly “git pull” a rebased history\n>> just to avoid a non-fast-forward push, and it irks me to no end.  So if\n>> I were running the world, the output would be:\n>>\n>>  error: rejected non-fast-forward push to '<url>'\n>>  hint: To prevent you from losing history, non-fast-forward updates are\n>>  hint: rejected by default.\n>>  hint: See the 'Note about fast-forwards' section of 'git push --help'\n>>  hint: for details.\n>\n> I actually like that ;-)\n>\n> Since we are discussing the \"advice\" part of the output, I don't think it\n> is so bad to add the three-bullet list below to it, either, though.\n\nThe error message is one that a normal user can see relatively\nregularly, as soon as he shares a bare-repository with co-workers, so\nI think it should remain short. That's why I took great care to remain\nwithin 3 lines in my patch.\n\nPerhaps the manpage can be improved, but that's a separate topic. My\none-line patch would make a great improvement for beginners, without\nharming advanced users, who still get the pointer to the doc.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"147888","messageId":"vpqvd7gp2q6.fsf@bauges.imag.fr","threadId":"24602","inReplyTo":"1280756564-3932-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-08-12T10:03:29Z","receivedAt":"2010-08-12T10:03:29Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hi,\n\nI'm sorry to insist, but nothing has happened to this patch, and I'd\nreally like it to get merged. The only reaction appart from Junio was\nJonathan, and althought it contained a disgression about \"if I were\nrunning the world\", it started with \"Your change is good.\" ;-).\n\nThanks,\n\nMatthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> The message remains fuzzy to include \"git pull\", \"git pull --rebase\" and\n> others, but directs the user to the simplest solution in the vast\n> majority of cases.\n>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> When the message was added, it was decided explicitely not to say\n> explicitely \"use git pull\", first because there are other ways to\n> merge, and then to encourage the users to read the docs.\n>\n> After a few months of teaching newbies/students to use Git, the\n> question \"it doesn't want to push, what shall I do\" still comes in the\n> top questions asked. Each time I've been asked, the newbie's face was\n> enlightened by hearing just the word \"pull\".\n>\n> So I guess those few extra characters in the error message would save\n> me a lot of time ;-).\n>\n>  builtin/push.c |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/push.c b/builtin/push.c\n> index f4358b9..69bc2f2 100644\n> --- a/builtin/push.c\n> +++ b/builtin/push.c\n> @@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags)\n>  \n>  \tif (nonfastforward && advice_push_nonfastforward) {\n>  \t\tfprintf(stderr, \"To prevent you from losing history, non-fast-forward updates were rejected\\n\"\n> -\t\t\t\t\"Merge the remote changes before pushing again.  See the 'Note about\\n\"\n> -\t\t\t\t\"fast-forwards' section of 'git push --help' for details.\\n\");\n> +\t\t\t\t\"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\\n\"\n> +\t\t\t\t\"'Note about fast-forwards' section of 'git push --help' for details.\\n\");\n>  \t}\n>  \n>  \treturn 1;\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"147931","messageId":"20100812192833.GA2029@burratino","threadId":"24602","inReplyTo":"vpqvd7gp2q6.fsf@bauges.imag.fr","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-12T19:28:33Z","receivedAt":"2010-08-12T19:28:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Matthieu Moy wrote:\n\n> I'm sorry to insist, but nothing has happened to this patch, and I'd\n> really like it to get merged. The only reaction appart from Junio was\n> Jonathan, and althought it contained a disgression about \"if I were\n> running the world\", it started with \"Your change is good.\" ;-).\n\nIndeed.  To be clear, I like your change. ;-)\n"},{"id":"148141","messageId":"vpqmxsnye3t.fsf@bauges.imag.fr","threadId":"24602","inReplyTo":"vpqvd7gp2q6.fsf@bauges.imag.fr","subject":"Re: [PATCH] push: mention \"git pull\" in error message for non-fast forwards","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-08-15T17:34:14Z","receivedAt":"2010-08-15T17:34:14Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Hi,\n>\n> I'm sorry to insist, but nothing has happened to this patch, and I'd\n> really like it to get merged. The only reaction appart from Junio was\n> Jonathan, and althought it contained a disgression about \"if I were\n> running the world\", it started with \"Your change is good.\" ;-).\n\nIt got merged into master. Thanks, Junio!\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}