Reputation: 2986
I am having this scenario when merging code using Git in Azure DevOps:
On 7/30: A pull request was created to merge code from Dev branch to Master choosing the Squash and Merge option. So, only one single commit was done without preserving all history.
From 7/31 to 8/6: All feature branches are already merge into the Dev branch with the Merge commit option preserving all commit history.
Now, on 8/7: I am trying to merge Dev branch to master one more time (doing this at the end of each Sprint). However, while creating the pull request something I noticed and took my attention is that on the pull request, I am getting older changes before 7/30.
Should not the pull request be showing/ displaying all changes done from 7/31 to 8/6?
Upvotes: 1
Views: 2284
Reputation: 19491
I think the older commits will be displayed because the last time you merged was squash merge.
Squash merging allows you to condense the commits of topic branches and adds them to a single new commit on the default branch. Instead of each commit on the topic branch being added to the history of the default branch.
This means that the original commits on the dev branch will not be merged to the master branch. Commits in pr shows all newly generated commits after the last merge,but since you choose squash merge, so the previous commits on the dev branch will also show up.
When squash merging, it's a good practice to delete the source branch. This prevents confusion as the topic branch itself does not have a commit merging it into the default branch.
The above reference is mentioned in the document.
Upvotes: 4