[ACCEPTED]-Creating git branch after many commits-branch

Accepted answer
Score: 65

on master:

git checkout -b newbranch or as suggested below, simply 7 do a git branch newbranch to create the new branch without switching 6 to it.

This will create a branch that is 5 at your current commit at master. Once 4 done:

git checkout master

followed by:

git reset --hard <commit_hash>

Where <commit_hash> should be replaced 3 by the commit ID you want master rolled 2 back to.

Now you can switch to your new branch 1 and push it out to the remote.

git checkout newbranch
git push origin newbranch

More Related questions