shorts

git rebase --onto <newbase> <oldbase>
  • Enables a more powerful form or rebase that allows passing specific refs to be the tips of a rebase

Explanation

Consider this example repo 👇🏽

We don’t want featureB to be based off featureA. We want it to be branched off main.

This is what we want 👇

Command that will help us get it 👇

git rebase --onto main featureA featureB

Sources