Reputation: 2523
I have a commit that has made changes to files A,B,C,D,E. This commit has been pushed to a remote server.
I would like to take the changes to files C and E and move them to a separate branch as they were pushed while unstable and we will not have time to 'stabilize' them before release.
I suppose what I'm asking is to get a previous commit on C and E to the HEAD and have those changes made be put into their own branch on the side for now.
Upvotes: 0
Views: 88
Reputation: 363497
Make a branch starting at the current HEAD
:
git branch newbranch
Undo the changes to HEAD
:
git revert --no-commit <the-faulty-commit>
git checkout -- A B D
git commit
You can later either merge with newbranch
(but make sure to pick the right merge strategy, or the revert
will take precedence) or revert
the revert
.
Upvotes: 3