I've done a stupid thing. I branched from branch A, made changes on a new branch, pushed and made a PR into branch B (also bringing a lot of unwanted commits into it).
My problem is that I need to get rid of several commits only on a branch where I made changes but I have no idea how to do it. There are many info on how to get rid of the last commit, but in my case it's exactly the last commit I want to leave on the branch.