I sent in a PR to a remote repo and discovered I had the commit from a previous PR included is it possible to delete this unwanted commit?
Asked
Active
Viewed 1,114 times
2
-
You should be able to decline the pull request from the GitHub UI. – Tim Biegeleisen Mar 16 '18 at 06:47
-
Thanks I'm using github cli – lauragift21 Mar 16 '18 at 06:51
-
Do you want to delete a _commit_ in a pull request, or the pull request itself? – Tim Biegeleisen Mar 16 '18 at 06:55
-
A commit in the pull request – lauragift21 Mar 16 '18 at 07:01
4 Answers
1
You can make a revert
commit for unwanted commits. In this answer should be enough info.

Mike Kor
- 876
- 5
- 14
-
Thanks, but that solution is for when the commit has not been pushed I already pushed still doesn't matter? – lauragift21 Mar 16 '18 at 06:53
-
it doesn't. It will be added as additional commit that reverses chosen commits code. – Mike Kor Mar 16 '18 at 06:54
1
Under your repository name, click Pull requests. In the "Pull Requests" list, click the pull request you'd like to close. At the bottom of the pull request, below the comment box, click Close pull request.
Then to revert the last commit or revert to the SHA of the commit ,you can use the command git revert HEAD~1 or git revert (get the commit id from git log)

Charu Jain
- 36
- 6
0
You may close a pull request from the GitHub website:
You may choose to close a pull request without merging it into the upstream branch. This can be handy if the changes proposed in the branch are no longer needed, or if another solution has been proposed in another branch.
- Under your repository name, click Pull requests.
- In the "Pull Requests" list, click the pull request you'd like to close.
- The close Pull Request buttonAt the bottom of the pull request, below the comment box, click Close pull request.
- Optionally, delete the branch. This keeps the list of branches in your repository tidy.

Tim Biegeleisen
- 502,043
- 27
- 286
- 360