I’ve done a fair bit of work (“Your branch is ahead of ‘origin/master’ by 37 commits.”) which really should have gone into its own branch rather than into master
. These commits only exist on my local machine and have not been pushed to origin
, but the situation is complicated somewhat in that other devs have been pushing to origin/master
and I’ve pulled those changes.
How do I retroactively move my 37 local commits onto a new branch? Based on the docs, it appears that git rebase --onto my-new-branch master
or ...origin/master
should do this, but both just give me the error “fatal: Needed a single revision”. man git-rebase
says nothing about providing a revision to rebase
and its examples do not do so, so I have no idea how to resolve this error.
(Note that this is not a duplicate of Move existing, uncommited work to a new branch in Git or How to merge my local uncommitted changes into another Git branch? as those questions deal with uncommitted changes in the local working tree, not changes which have been committed locally.)