I know there are several similar questions, but I think my situation is a little bit different.
Let\'s say there is a GitHub repository which I want to contribute to
I have the same problem with you and just solved this problem.
To solve this:
'Reset' your local repo to the moment before the abundant commits
Create a new branch using this amended local repo
'Publish' this amended local repo to your github repo
Make the changes that you want to PR to github in the amended local repo
'Commit' this local repo
'Pull' the commit to your github repo
On your github repo new branch, submit pull request to the upstream repo
Hope this answer could help.