Git Rebase onto new base
A usual case is that you have a feature branch (named featureA). Out of it, you create a new one (named featureB). But then you rebase the original (featureA) to master.
Let's say you have the following example:
A---B---C---D master
\
E---F---G featureA
\
H---I---J featureB
As you see, additional commit (D) appeared on the master branch. Thus, we want to rebase the featureA branch:
git checkout featureA
git rebase origin/master
This will result in the following state:
A---B---C---D master
| \
| E'---F'---G' featureA
\
E---F---G featureB'
\
H---I---J featureB
Branch named featureA now has new commits which are different (have new SHA) than the originals. This means that featureB has all the original commits from featureA beside the commits of featureB branch. However, we want to rebase featureB branch to featureA with only commits that we made on featureB (H,I,J). To do that, we can use --onto parameter:
git rebase --onto featureA featureB~3 featureB
This basically means that we want to rebase last three commits from featureB to featureA. The featureB~3 should point to the first commit on the featureB branch. Which brings us to:
A---B---C---D master
\
E'---F'---G' featureA
\
H'---I'---J' featureB
Another use for onto parameter would be to remove some commits on one branch. That case is described in the documentation as linked in the reference.