git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Update message_advice_pull_before_push to mention how to push after rebasing
@ 2024-03-28  9:54 zhang kai
  2024-03-28 11:49 ` Rubén Justo
  2024-03-28 15:23 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: zhang kai @ 2024-03-28  9:54 UTC (permalink / raw)
  To: git

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. If this is acceptable, we'd be
happy to prepare a patch.

Thanks,
Kai

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

end of thread, other threads:[~2024-03-29  7:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).