branching-and-merging - git create new branch - Move the most recent commit(s) to a new branch with Git
git checkout / git / git-branch
I'd like to move the last several commits I've committed to master to a new branch and take master back to before those commits were made. Unfortunately, my Git-fu is not strong enough yet, any help?
I.e. How can I go from this
master A - B - C - D - E
newbranch C - D - E / master A - B
To avoid this:
1) git checkout master 2) git branch <feature branch> master 3) git reset --hard <commit hash> 4) git push -f origin master