There's more...

The same thing could actually be achieved with a single short Git command. We have been rebasing commits from the origin/stable-3.2 branch to the rebaseExample branch onto the origin/stable-3.2 branch. This can also be achieved in the following manner:

$ git rebase --onto origin/stable-3.1 origin/stable-3.2 rebaseExample
First, rewinding head to replay your work on top of it...
Applying: My brand new fishtank
Applying: Feed the fish

The --onto origin/stable-3.2 flag tells Git to rebase onto origin/stable-3.2, and it has to be from origin/stable-3.1 to the rebaseExample branch. So, we end up having the rebaseExample branch to the branch of the origin/stable-3.1 and so on. The next diagram illustrates both before the rebase ...

Get Git Version Control Cookbook 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.