Skip to content

status, push: handle a push branch rebased onto a newer upstream

Harald Nordgren via GitGitGadget git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6status: count push divergence outside the upstreamremote.c t/t6040-tracking-info.sh+100 -130 replies
2/6status: say when the push branch was rebased cleanlyremote.c t/t6040-tracking-info.sh+69 -100 replies
3/6status: suggest a force push after a clean rebaseremote.c t/t6040-tracking-info.sh+6 -20 replies
4/6push: name the branch to pull from when it is not the upstreambuiltin/push.c t/t6040-tracking-info.sh+91 -30 replies
5/6push: offer a force push after rewriting pushed commitsbuiltin/push.c t/t6040-tracking-info.sh transport.c +1 more+79 -110 replies
6/6push: suggest a force push after a clean rebasebuiltin/push.c remote.c remote.h +1 more+65 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] status, push: handle a push branch rebased onto a newer upstream

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

Signature · 1 line
gitgitgadget