On the files comparison of a PR, it does not only compare the file changes between the source branch and target branch. It will compare the commit history between them.
It is a correct behavior if you use the squash merge multiple times to merge changes from a branch to another one. Because instead of each commit on the topic branch being added to the history of the default branch, a squash merge takes all the file changes and adds them to a single new commit on the default branch.
This means that when you use squash merge to merge a PR, only the file changes on the source branch (feature
in your case) will be merged and generate a new commit on the target branch (develop
in your case). The commit history for these file changes on the source branch will not be merged to the target branch.
Generally, when completing the squash merge, you should delete the source branch. And in the next time if you still want to use the squash merge, you can create a new source branch (you can still use the same branch name feature
) based on the target branch. Then make changes on the new source branch, merge changes to the target branch using squash merge, delete the source branch.
If you do not delete the source branch when using the squash merge, and in the next time you continue making and merging changes from this source branch to the target branch, you may get some conflicts and extra changes just like the problem you are facing.
At this time, if there are conflicts, resolve the conflicts then you can complete the merge as usual. If no conflicts, you can directly complete the merge as usual. When completing the merge, do not forget to delete the source branch.
To view more details, you can see "Squash merge pull requests".
