One relatively easy solution is to create a complete new branch from the master
(or the branch you want to merge into) and then cherry-pick only the commits you want to include in the PR one by one from your old branch. And then you need to force push to github using the original branch name.
git checkout -b new_attempt origin/master
git cherry-pick <commit1>
git cherry-pick <commit2>
...
git push --force origin new_attempt:mybranch
where the mybranch
is the name of the branch you've used for this PR.
If the commits are too many you can try rebase with --onto
option.
git rebase --onto origin/master <base_commit> mybranch
git push --force origin mybranch
where the <base_commit>
is the last commit you want to exclude from the PR. Rebasing could be bit tricky so make a backup and read git-rebase docs