I have a PR up on github and I accidentally merged master into my PR and pushed it. Now the PR shows way more files changes than the ones just changed by me because the master was merged in. How can I just delete the previous to merge master commits from the PR?
I tried doing git revert <hash> and now the PR commits look like this. However, the total number of Files Changed is still incorrect. It is showing files that I didnt' change.
The PR commits look like this:
My good commit
Merge branch 'master' into this-prbranch
Revert "Merge branch 'master' into this-prbranch"
You can first locate the merge commit with git log, take down its SHA.
Then, revert your tree to the point before it:
git reset --hard abcdef8~
(apparently you should replace abcdef8 with the SHA of the merge commit)
And force-push the reverted tree:
git push -f
Why does git revert not work as expected?
From git-revert(1):
Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With