How To Move The X Most Recent Commits To Another Branch With Git

Posted by Weston Ganger on January 31, 2017

I needed a safe method to move the last x commits on my repo to a new branch. Two simple commands to get you there

# this will move the last 3 commits from master into newbranch
git checkout -b newbranch
git branch -f master HEAD~3

Related External Links:

Posted in Linux and Tagged with git 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts