git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Rubén Justo" <rjusto@gmail.com>
To: zhang kai <kylerzhang11@gmail.com>, git@vger.kernel.org
Subject: Re: Update message_advice_pull_before_push to mention how to push after rebasing
Date: Thu, 28 Mar 2024 12:49:30 +0100	[thread overview]
Message-ID: <8d226216-9a80-471e-9d7b-3ca8d21c1e05@gmail.com> (raw)
In-Reply-To: <CAK_130T8sZUZAuvj4x7sB278kVL7ARaBv3Pg2djQB45O+7xKTg@mail.gmail.com>

On Thu, Mar 28, 2024 at 05:54:13PM +0800, zhang kai wrote:
> Hi all,
> 
> Our team uses git rebase a lot. A common hiccup we noticed during the
> daily work is that new devs often didn't know how to push properly
> after the rebase.
> 
> When someone try to push to the remote after rebasing the branch, the
> push would mostly fail with the message_advice_pull_before_push:
> 
> > Updates were rejected because the tip of your current branch is behind\n" "its remote counterpart. If you want to integrate the remote changes,\n" "use 'git pull' before pushing again.\n" "See the 'Note about fast-forwards' in 'git push --help' for details.
> 
> However, in this situation, pull will "invalid" the rebasing. After
> pull then push, devs often will be surprised by the merge/pull request
> containing diffs that should not be in this branch. In this case, we
> often should just do `git push --force-with-lease`.
> 
> If we add a message like "If you just rebased your branch, please
> consider 'git push --force-with-lease'" to the
> message_adivce_pull_before_push, we may save devs some time figuring
> out what's wrong with their branch.

It does sound sensible ...

> If this is acceptable, we'd be
> happy to prepare a patch.

... but you should better expect acceptance after sending a concrete
series that makes the objective clear ;)

I see that we are using, in builtin/push.c, the form:

	if (advice_enabled(XXX))
		advise(YYY)

It would be well received, I think, if your proposal includes a change
for that, to start using the now preferred advise_if_enabled() mechanism.

Of course, this is entirely optional and does not need to be done in the
context of this hypothetical series.

Thanks.


  reply	other threads:[~2024-03-28 11:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  9:54 Update message_advice_pull_before_push to mention how to push after rebasing zhang kai
2024-03-28 11:49 ` Rubén Justo [this message]
2024-03-28 15:23 ` Junio C Hamano
2024-03-28 17:19   ` zhang kai
2024-03-28 17:35     ` Junio C Hamano
2024-03-29  7:41       ` zhang kai

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=8d226216-9a80-471e-9d7b-3ca8d21c1e05@gmail.com \
    --to=rjusto@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kylerzhang11@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).