I am trying to contribute to a GitHub repository. The commit from before I started contributing I'll call "a". I made a commit "b" and my pull request for it was accepted. I then made another commit "c" and I have made a pull request for it but it has not yet been accepted. I made another commit "d" which I committed to a new branch so I'd be able to pull it separately. However, I forgot to rebase back to "b" before creating "d" so the branch for "d" also contains "c" meaning "c" would exist on both branches which I don't want.
So, currently I have this
a-b-c-d
But I want this
a-b-c
\-d
How can I accomplish this?
This question has been marked as a duplicate of questions asking how to undo the last commit, but these do not answer my question because it's not the last commit I'm trying to undo but instead a commit twice back. Rebasing to HEAD{2} also doesn't work because that still undo's the last commit.