Skip to main content

git-rebase-branches

Rebase multiple branches at once.


Say I have a number of feature branches, and new commits are added to main:

dmtucker@localhost:/tmp/tmp.97ZHC4YUiK $ git branch -vv
  feature1 2511789 Add feature #1
  feature2 339ff60 Make fizz do buzz
* feature3 618d195 Improve thing greatly
  main     77bf560 New commits to main!

My feature branches are no longer based on main and all need to be rebased:

dmtucker@localhost:/tmp/tmp.97ZHC4YUiK $ git log --graph feature1 feature2 feature3 main
* 618d195 (HEAD -> feature3) Improve thing greatly
| * 339ff60 (feature2) Make fizz do buzz
|/
| * 2511789 (feature1) Add feature #1
|/
| * 77bf560 (main) New commits to main!
|/
* cd9b6c6 Initial commit

git-rebase-branches can help with that:

dmtucker@localhost:/tmp/tmp.97ZHC4YUiK $ git-rebase-branches main
$ git for-each-ref --no-contains main '--format=%(refname:short)' refs/heads/
feature1
feature2
feature3
$ git stash push --include-untracked
No local changes to save
$ git log -n1
618d195 (HEAD -> feature3) Improve thing greatly
$ git rebase main feature1
Successfully rebased and updated refs/heads/feature1.
$ git rebase main feature2
Successfully rebased and updated refs/heads/feature2.
$ git rebase main feature3
Successfully rebased and updated refs/heads/feature3.
$ git -c advice.detachedHead=false checkout feature3
Already on 'feature3'

==================================== SUMMARY ====================================
- feature1 (succeeded)
- feature2 (succeeded)
- feature3 (succeeded)
  • Note: Once you run the first command, git-rebase-branches prints and runs the rest.

Now, all feature branches are based on main:

dmtucker@localhost:/tmp/tmp.97ZHC4YUiK $ git log --graph feature1 feature2 feature3 main
* 069fcca (HEAD -> feature3) Improve thing greatly
| * e32b491 (feature1) Add feature #1
|/
| * 8fffd21 (feature2) Make fizz do buzz
|/
* 77bf560 (main) New commits to main!
* cd9b6c6 Initial commit

Metadata

Release files for git-rebase-branches 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-rebase-branches 2.1.0
File Size Uploaded Provenance
git_rebase_branches-2.1.0.tar.gz 15.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for git-rebase-branches 2.1.0
File Interpreter ABI Platform
git_rebase_branches-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / git_rebase_branches-2.1.0.tar.gz

Download URL git_rebase_branches-2.1.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c7050ff2f1dd46da32e0371d20f4a8bd0685282787b02ed613d45b8da4743dd5
BLAKE2b-256 checksum
How to use checksums
7546f2ff458517ebe3eb465a9f1635e82fe42d048780df1cd54bed1bc29ccaf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.25

Release files / git_rebase_branches-2.1.0-py3-none-any.whl

Download URL git_rebase_branches-2.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43b0e6c010cfe93b199087d0736872e6dc83e6a7db110110ab4b7e16b4aee85a
BLAKE2b-256 checksum
How to use checksums
0b7bb622e2b8b6fb50783cb3935ebb43a46f2a9f8d083dc9a06c446977f3b239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.25

Security for git-rebase-branches 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page