Before I make a change to my PR, as requested by the maintainers, I do a git pull --rebase upstream master to place my commits on top of other new commits in the code base.
However, this seems to pollute the diff of my PR with changes from other commits.
Why is this happening?
Since the base of my PR is upstream/master, and I have just git pull --rebase upstream master, shouldn't the diff only show my code?
I do this all the time and have found the following process the best way to solve it:
Write down the git commit hashes for all commits in the PR that you want to save (i.e. your commits).
Then run the following:
git fetch upstream
git reset --hard upstream/master
git cherry-pick <hash 1>
git cherry-pick <hash 2>
// cherry-pick all of your commits then:
git push -f origin your-branch
And it should fix your PR automatically
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