zulhfreelancer
4/18/2016 - 6:57 AM

How to move the most recent commit(s) to a new branch (Git)

How to move the most recent commit(s) to a new branch (Git)

In master branch, make sure you commit what you've done first!

Then, follow this:

$ git branch newbranch
$ git reset --hard <hash_of_the_commit>
$ git checkout newbranch

Example

$ git branch newbranch
$ git reset --hard d40ef79
$ git checkout newbranch