Sometimes I branch off of the wrong branch. So I need to rebase my branch onto the correct branch.
> git checkout myCurrentBranch > git rebase -i --onto <targetBranch> <fromCommit> <toCommit>
Meaning: “git rebase myCurrentBranch onto targetBranch, moving moving all commits since myCurrentBranch diverged from fromCommit until toCommit to targetBranch.”
More information: More-interesting-rebases
This often times results in a detached head….
This stackoverflow entry might have some help: How can I reconcile detached HEAD with master/origin?