Linux

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 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts