I wrote some code to implement two new features on a project, but I committed the changes to master. I now realize that this was a mistake, because one of the features is working well, and the other is not.
I would like to keep the working feature code in master, but remove the non-working feature code from master.
I'd like to have the current version of the project (with both features) in a new branch.
I would just create a new branch from master and then remove the code from the non-working feature from master, but I'm worried that the commits will basically be in the wrong order, and when I merge the branch back into master at some point, git will just discard the code for the non-working feature because the new branch will have been behind commits that remove that code.
Is there a better way to do this?