Click on the <> ("Browse the repository at this point in the history") on the commit you want to branch from.
Click on the "tree: xxxxxx" up in the upper left. Just below the language statistics bar, you'll get the option to "Find or Create Branch" (just type in a new branch name there)
To do this on github.com:
The magic can be done by git reset.
Create a new branch and switch to it (so all of your latest commits are stored here)
git checkout -b your_new_branch
Switch back to your previous working branch (assume it's master)
git checkout master
Remove the latest x commits, keep master clean
git reset --hard HEAD~x # in your case, x = 3
From this moment on, all the latest x commits are only in the new branch, not in your previous working branch (master) any more.
This is what I did:
In this case,
8a75b001096536b3216022484af3026aa9c7bb5b
was and old commit belonging to themaster
branch.You can create the branch via a hash:
Or by using a symbolic reference:
To checkout the branch when creating it, use
I was able to do it like so:
Where you must enter the skip value. 0 is the latest, 1 is the previous, 2 is the commit before that, etc.
A quick way to do it on your Github repo would be as followed: