Retroactively treat line of Git commits as a branch -


a bunch of questions ask how rewrite (rebase) commits appear on branch, these seem assume rebase necessary, i.e. commits wanted branch interspersed commits wanted on master (whether made “you” or others).

this question simpler: have clone of repository on master branch, , made bunch of commits intending create github pull request. have run

git checkout -b new-feature 

before starting commits, in case forgot. can retroactively mark sequence commits being on new branch (without needing use git rebase)?

you can move commits branch , reset master branch with:

git branch new-feature git reset --hard origin/master 

note blow away uncommitted changes, if problem should use git stash before starting save them away.


Comments