contrib/rebase-catchup: helper for updating old branches
PATCH 1/1 contrib/rebase-catchup: helper for updating old branches
For people who want to rebase their work onto the latest branch (instead of merging), but there's many conflicting changes. This allows you to address those conflicts one-by-one and work through each issue instead of trying to take them all on at once.
---
If there's no interest in merging this into contrib, then this is more spam, and anyone interested can use https://github.com/vapier/git-rebase-catchup
contrib/rebase-catchup/README.md | 61 ++++++ contrib/rebase-catchup/git-rebase-catchup.py | 187 +++++++++++++++++++ 2 files changed, 248 insertions(+) create mode 100644 contrib/rebase-catchup/README.md create mode 100755 contrib/rebase-catchup/git-rebase-catchup.py
contrib/rebase-catchup/README.md new file +61 -0
@@ -0,0 +1,61 @@ +# Rebase Catchup + +Helpful when you have a branch tracking an old commit, and a lot of conflicting +changes have landed in the latest branch, but you still want to update. + +A single rebase to the latest commit will require addressing all the different +changes at once which can be difficult, overwhelming, and error-prone. Instead, +if you rebased onto each intermediate conflicting point, you'd break up the work +into smaller pieces, and be able to run tests to make sure things were still OK. + +## Example + +Let's say you have a branch that is currently 357 commits behind. When you try +rebasing onto the latest, it hits a lot of conflicts. The tool will bisect down +to find the most recent commit it can cleanly rebase onto. + +```sh +$ git rebase-catchup +Local branch resolved to "s-logs" +Tracking branch resolved to "origin/master" +Branch is 2 commits ahead and 357 commits behind +Trying to rebase onto latest origin/master ... failed; falling back to bisect +Rebasing onto origin/master~178 ... failed +Rebasing onto origin/master~267 ... failed +Rebasing onto origin/master~312 ... failed +Rebasing onto origin/master~334 ... failed +Rebasing onto origin/master~345 ... OK +Rebasing onto origin/master~339 ... OK +Rebasing onto origin/master~336 ... failed +Rebasing onto origin/master~337 ... OK +Rebasing onto origin/master~336 ... failed +Found first failure origin/master~336 +``` + +Now you know the first conflicting change is `origin/master~336`. Rebase onto +that directly and address all the problems (and run tests/etc...). Then restart +the process. + +```sh +$ git rebase origin/master~336 +... address all the conflicts ... +$ git rebase --continue +$ git rebase-catchup +Local branch resolved to "s-logs" +Tracking branch resolved to "origin/master" +Branch is 2 commits ahead and 335 commits behind +Trying to rebase onto latest origin/master ... failed; falling back to bisect +Rebasing onto origin/master~167 ... OK +Rebasing onto origin/master~83 ... OK +Rebasing onto origin/master~41 ... failed +Rebasing onto origin/master~62 ... OK +Rebasing onto origin/master~51 ... OK +Rebasing onto origin/master~46 ... OK +Rebasing onto origin/master~43 ... failed +Rebasing onto origin/master~44 ... failed +Rebasing onto origin/master~45 ... OK +Rebasing onto origin/master~44 ... failed +Found first failure origin/master~44 +``` + +Now you're only 44 commits behind. Keep doing this until you catchup!
contrib/rebase-catchup/git-rebase-catchup.py new file +187 -0
187 lines not on this page · raw message
Signature · 1 line
2.30.0
Quoted 4 lines · Mike Frysinger
For people who want to rebase their work onto the latest branch (instead of merging), but there's many conflicting changes. This allows you to address those conflicts one-by-one and work through each issue instead of trying to take them all on at once.
I wonder how well this compares or complements with Michael Haggerty's "git imerge".
Quoted 2 lines
If there's no interest in merging this into contrib, then this is more spam, and anyone interested can use https://github.com/vapier/git-rebase-catchup
The thinking during the past several years is that the Git ecosystem and userbase have grown large enough, and unlike our earlier years, individual add-on's like this (and "imerge" I mentioned earlier) can thrive without being in-tree to gain an undue exposure boost over its competitors, so I doubt that adding more stuff to contrib/ would be a good direction to go in the longer term.
Quoted 1 line
create mode 100755 contrib/rebase-catchup/git-rebase-catchup.py
And it does not help for this to be written in Python (which we've been moving away from).
Having said all that, the end-user community may benefit from having a well curated set of third-party tools advertised at a single autoritative-sounding place, but it is dubious that contrib/ subdirectory of my tree should be such a place (I won't be its curator anyway).
Perhaps there is an opening for non-code contribution for those without much programming experience but with great organizational skills.
Thanks.
Quoted 8 lines · Junio C Hamano
Quoted 4 lines · Mike Frysinger
For people who want to rebase their work onto the latest branch (instead of merging), but there's many conflicting changes. This allows you to address those conflicts one-by-one and work through each issue instead of trying to take them all on at once.
I wonder how well this compares or complements with Michael Haggerty's "git imerge".
thanks, hadn't heard of that before
Quoted 9 lines
Quoted 2 lines
If there's no interest in merging this into contrib, then this is more spam, and anyone interested can use https://github.com/vapier/git-rebase-catchup
The thinking during the past several years is that the Git ecosystem and userbase have grown large enough, and unlike our earlier years, individual add-on's like this (and "imerge" I mentioned earlier) can thrive without being in-tree to gain an undue exposure boost over its competitors, so I doubt that adding more stuff to contrib/ would be a good direction to go in the longer term.
i'm totally fine with "no". thanks for the info.
-mike