I need to perform this series of actions every few weeks, but can never remember the commands.
- branch off of
feature-1up for code review, and start working on
feature-2by branching from
feature-1is eventually merged into
feature-2’s commits need to change to be on top of
git rebase --onto dev feature-1 feature-2
assuming you already have branch
feature-2 checked out (because you are actively working on it), you can remove the last argument (the target branch to change)
git rebase --onto dev feature-1
so it reads like:
git rebase --onto <to> <from> <branch-to-manipulate>
more details at git-scm.com
I like this quote:
The current branch is reset to <upstream>, or <newbase> if the —onto option was supplied. This has the exact same effect as
git reset —hard <upstream>(or <newbase>). ORIG_HEAD is set to point at the tip of the branch before the reset.