Matthieu Moy <> writes:

> Signed-off-by: Matthieu Moy <>
> ---
> 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/ |  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.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to