Move The X Most Recent Commits To Another Branch With Git

Posted By Weston Ganger

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:

Article Topic:Software Development - Linux

Date:January 31, 2017