How To 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

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected