I have a master and development branch. The main (server) repos are hosted in Azure Devops (on premise). I did two Pull Requests (from feature branches into development) for changes in my development branch.
PR1: feature-branch-1 -> development
PR2: feature-branch-2 -> development
Then I thought, I need to sync my development branch with my master branch, so I did a Pull Request from my development branch to my master branch, accepted, committed.
PR3: development -> master
Now it is saying my development branch is "1 behind and 2 ahead of master"
Comparing development to master shows my two feature Pull Requests. Comparing master to development shows my merge PR to sync the branches.
What in my process did I do wrong, and how do I fix this - get them in sync?
The process you did is correct, but depending on what you chose one of the following happened.
To make sure develop is back in sync with master, you have a few options:
Now it is saying my development branch is "1 behind and 2 ahead of master"
Comparing development to master shows my two feature Pull Requests. Comparing master to development shows my merge PR to sync the branches.
No error about your operation, and the answer(1 behind and 2 ahead of master
) is also correct.
Before all, you need to know what does "Squash Merge" mean.
Let's name these commits: merge commit from feature-branch-1 to Development is A. The commit from feature-branch-2 to Development is B. The merge commit created from Development to Master is C.
While performing merge feature-branch-1 to Development with Squash Merge
, it will create new commit A'. In fact, compare with their content, there's no defference between A and A'. But the feature branch itself does not have a commit merging it into the default branch.
So, follow this logic. While you performing merge Development to Master, it will create one new commit C'. After merge, in Master branch, it just add one new commit C', not C. That's why you get the behind|ahead as 1 behind and 2 ahead of master
.
Change your compare branch to Development, you will see that the behind|ahead of your feature-branch-1 and feature-branch-2 is 2|1. That's all because of Squash Merge.
The advantage of Squash Merge is keeping your default branch histories clean and easy to follow without demanding any workflow changes on your team.
But if you want get them in sync with history, please change your merge type as Basic Merge.
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