Let\'s say I have:
A - B - C - D - E - F master
\\
\\- G - H new feature branch
Now I realize that commits B an
You can do this with git rebase.
First, let's rebase some commits from master:
$ git checkout master
$ git rebase --onto A C
This will move all commits in the range from C to master (but not including C itself) onto the commit A.
Now rebase feature but throw out commit D:
$ git checkout feature
$ git rebase --onto C D
Similar to the previous command, this will move commits in the range from D to feature (not including D itself) onto C.