Part of the source code management is to be able to quickly determine the difference between your branch and the main development branch. Usually this happens to be the master but this can quickly change if you are following feature based development or trunk based development. VSTS has the concept of the compare branch where it would provide the number of commits ahead or behind data for all other branches. This helps one in quickly determining the related information by just taking a glance at the branch page.
To set a different branch as the compare branch, select the branch in the reference and click on the three dot icon:
Once its set, we can see that the compare label will shift to the newly selected branch:
Default branch is the branch which will be auto selected to merge code into, when someone creates a pull request. Again, this is usually the master branch. To change this to a different branch, first we need to get into the manage repository view or go to project settings -> repositories. After this, click on the git repository in the reference and then expand ‘branches’ for all the branches. After this select the … next to the branch you want to set as default, then select ‘Set as default branch’:
It may appear that instead of the default branch, pull requests and new branches created from the branches page will be based off the branch you set as the compare branch. However this setting is remembered on the per user basis. Setting the default branch is a way to set the default for your entire team. It is a way to set a reasonable default for when new users use your repository. However, if a user wishes they can diverge from the default by setting their own ‘compare’ branch.