I hit this after creating a PR for a fix into another development branch.
After noticing the changes I hadn't made in the PR, I merged out from main into both branches. That didn't help. But, the extra changes disappeared after I merged the destination branch into my branch.
git checkout <fix branch>
git merge <destination brach>
git commit -a
git push
Before doing this, I saved a copy of my source branch. Its commit history shows only one of the merges: Merge branch 'main' into <fix branch>
. After merging as above, a new commit precedes this one in the history Merge branch 'main' into <destination branch>
.
The commit introduced by the merge out from destination (above) shows no changes. Also, before merging, diffs between the branches weren't showing changes that the PR was including.
Before the new merge from destination, it appears the PR was failing to reflect changes introduced to the destination branch after the PR had been opened. For me, merging out from the destination branch reset things to the expected state.