This is what my commit history looks like (everything has been pushed to Github where my repo is stored, but I'm the only contributor):
master
|
..-c100-c101-c102-c103-...-c150
I need to revert master
to the c100
commit while keeping the remaining commits (ie: c101-c102...-c150
), I don't want to loose them.
So this is what I came up with:
git checkout -b new-branch # Set up branch containing all commits
git checkout master # Go back to master
git revert <c-100> # Revert master branch to c-100 commit
which would (hopefully) result in:
master
|
..-c100-c101-c102-c103-...-c150
|
new-branch
Ideally I would then make a few commits to master to then leave it untouched until I can merge the new branch into it.
Is this the correct way to do this?
Add
Well just tried it and using git revert <SHA>
does not work, it only reverts that commit.