VSTS: Difference between default and compare branch

I did some quick tests in my VSTS tenant. It looks like the default branch of a new pull request is always the Compare branch, rather than the Default branch. So if you set your master branch as Compare branch, it should become to the default for new pull requests.

Not sure if it is bug of VSTS, or if they change the behavior of pull request without updating the doc.

Update:

I did some further research. It turned out that this change was introduced in a Oct 2016 feature roll out:

You can now set your compare branch to something other than the default branch. This setting will be remembered on a per-user basis. Pull requests and new branches created from the Branches page will be based off the branch you set as the compare branch.

So the doc needs to be updated.


For default branch, it helps you to treat the branch as default when cloning the git repo locally or creating a PR.

Such as if you treat master branch as default branch (by default), when you cloned the git repo locally, the local branch is master. And when you creating a PR, it will automatically treat master branch as the target branch.

For compare branch, it helps you to decide how many commits on the other branches are behind or ahead by comparing commits on other branches with the compare branch.

enter image description here

Such as for above example, develop branch is compare branch, and master branch and nn1 branch are compare with develop branch.

For comparing master branch with develop branch, there has 0 commits behind and 0 commit ahead (master branch same as develop branch). For comparing nn1 branch with develop branch, there are 3 commits behind and 48 commits ahead.

Tags:

Azure Devops