git rebase should always save the previous state of the branch being rebased in ORIG_HEAD, so if you screw it up and get the branch names the wrong way around you should just be able to do "git reset --hard ORIG_HEAD" so long as you realise immediately (or "git rebase --abort" if the rebase failed partway through).