29 | Moving Branches |
Sometimes you need to move branches around to reorganize them. For
example, you have a branch where youâre working on a future version
of your software. During the rewrite, your team realizes that the
better-widget
feature can be released as a
minor version of your software instead of being part of the next
major version. This is where you can move a branch to make your
repository more sane.
You use git rebase --onto
to move
branches. Like a normal git rebase
, Git
replays the commits from one branch against another. The
difference is that Git takes the branch youâre rebasing, and instead
of replaying it against another branch, it moves it to an entirely
different one.
The syntax is more verbose than a simple
Get Pragmatic Guide to Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.