Git development
 help / color / mirror / Atom feed
From: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Harald Nordgren <haraldnordgren@gmail.com>
Subject: [PATCH 0/6] status, push: handle a push branch rebased onto a newer upstream
Date: Tue, 06 Oct 2026 07:08:18 +0000	[thread overview]
Message-ID: <pull.2437.git.git.1791270504.gitgitgadget@gmail.com> (raw)

git status now tells when the push branch only differs because your work was
rebased onto a newer upstream.

With status.compareBranches including @{push}, when your branch and the push
branch have diverged:

 * commits from @{upstream} are counted apart: (1 and 1 not in
   'upstream/main')
 * if the rest carry the same changes on both sides: (rebased cleanly on
   'upstream/main'), with a hint to git push --force-with-lease
 * if nothing came from @{upstream}, the message is unchanged

When git push is rejected because the branch it updates has diverged:

 * if someone else updated your upstream branch, the hint still says git
   pull
 * if you amended or rebased commits you already pushed, the hint offers git
   pull and git push --force-with-lease
 * if they were rebased cleanly, the hint offers git push --force-with-lease

Harald Nordgren (6):
  status: count push divergence outside the upstream
  status: say when the push branch was rebased cleanly
  status: suggest a force push after a clean rebase
  push: name the branch to pull from when it is not the upstream
  push: offer a force push after rewriting pushed commits
  push: suggest a force push after a clean rebase

 builtin/push.c           |  62 ++++++++++++++-
 remote.c                 | 132 +++++++++++++++++++++++++++----
 remote.h                 |   6 ++
 t/t6040-tracking-info.sh | 163 +++++++++++++++++++++++++++++++++++++++
 transport.c              |  42 +++++++++-
 transport.h              |  13 ++--
 6 files changed, 393 insertions(+), 25 deletions(-)


base-commit: 8103b446517e0c44e67561b9d0ccce56efa60a71
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2437%2FHaraldNordgren%2Fstatus-push-not-in-upstream-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2437/HaraldNordgren/status-push-not-in-upstream-v1
Pull-Request: https://github.com/git/git/pull/2437
-- 
gitgitgadget

             reply	other threads:[~2026-10-06  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06  7:08 Harald Nordgren via GitGitGadget [this message]
2026-10-06  7:08 ` [PATCH 1/6] status: count push divergence outside the upstream Harald Nordgren via GitGitGadget
2026-10-06  7:08 ` [PATCH 2/6] status: say when the push branch was rebased cleanly Harald Nordgren via GitGitGadget
2026-10-06  7:08 ` [PATCH 3/6] status: suggest a force push after a clean rebase Harald Nordgren via GitGitGadget
2026-10-06  7:08 ` [PATCH 4/6] push: name the branch to pull from when it is not the upstream Harald Nordgren via GitGitGadget
2026-10-06  7:08 ` [PATCH 5/6] push: offer a force push after rewriting pushed commits Harald Nordgren via GitGitGadget
2026-10-06  7:08 ` [PATCH 6/6] push: suggest a force push after a clean rebase Harald Nordgren via GitGitGadget

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=pull.2437.git.git.1791270504.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=haraldnordgren@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox