Reputation: 1717
I merged into the main master branch of my git tree a feature that was half-baked. Later, I made a couple of commits in "master" that affected completely unrelated files. All of this has been pushed to remote as well.
Now I want to revert the changes made in that half-baked feature, but without losing the later commits. How can I do that?
Upvotes: 0
Views: 41
Reputation: 1964
You can checkout the files affected by the half baked feature to the commit before you merged.
# find the commit hash with
git log
# checkout those files to the commit you want
git checkout c5f567 -- file1/to/restore file2/to/restore
# commit to master
Upvotes: 1