git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] status: add advice on how to push/pull to tracking branch
Date: Thu, 15 Nov 2012 09:53:41 -0800	[thread overview]
Message-ID: <7vr4nu92hm.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1352976300-20159-1-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Thu, 15 Nov 2012 11:45:00 +0100")

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

> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> I thought this was obvious enough not to deserve an advice, but a
> colleague of mine had troubles with "commited but not pushed" changes.
> Maybe an additional advice would have helped. After all, it's an
> advice, and can be deactivated ...
>
>  remote.c                   | 13 ++++++++++---
>  t/t2020-checkout-detach.sh |  1 +
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 04fd9ea..9c19689 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1627,13 +1627,15 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
>  
>  	base = branch->merge[0]->dst;
>  	base = shorten_unambiguous_ref(base, 0);
> -	if (!num_theirs)
> +	if (!num_theirs) {
>  		strbuf_addf(sb,
>  			Q_("Your branch is ahead of '%s' by %d commit.\n",
>  			   "Your branch is ahead of '%s' by %d commits.\n",
>  			   num_ours),
>  			base, num_ours);
> -	else if (!num_ours)
> +		strbuf_addf(sb,
> +			_("  (use \"git push\" to publish your local commits)\n"));
> +	} else if (!num_ours) {

The message should make it clear that the two words in double quotes
only hint what command is used to "publish your local commits" and
not to be taken as literal "here is what you exactly would type",
but I do not think that is what I would get from this if I were a
total newbie who would need this advise.

It is even more true given that this is showing an arbitrary, and
more likely than not a non-current branch, especially with the
recent move from "matching" to "simple" where a naive use of "git
push" is to push the branch that is currently checked out and no
other branches.

	see 'git push --help' to learn how to publish your local commits

might be more appropriate.

> +		strbuf_addf(sb,
> +			_("  (use \"git pull\" to update your local branch)\n"));
> +	} else {

Likewise, and the non-currentness of the branch being described is
even worse in here, as unlike "git push" that can still be used to
push a non-current branch, "git pull" is never to be used to update
local branch that is not current, which means the advice must mention
"git checkout" somewhere.

  reply	other threads:[~2012-11-15 17:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 10:45 [PATCH] status: add advice on how to push/pull to tracking branch Matthieu Moy
2012-11-15 17:53 ` Junio C Hamano [this message]
2012-11-15 19:40   ` Matthieu Moy
2012-11-15 21:49     ` Junio C Hamano
2012-11-16  9:27       ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr4nu92hm.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).