Base vs default branch in bitbucket version of git

Viewed 23644

Why there exists two different types of branches, base and default in Bitbucket? In my mind I understand that the master branch most of the times should be the default branch, i.e. the branch that everyone in the team should use as a reference and as also the branch that "guidelines" the development. But what different functionality a base branch may introduce? Thank you for your patience.

2 Answers

In Bitbucket, the base branch is the last branch that you have selected from the list of branches. If you select another branch in the drop-down menu, you will see how the "base branch" icon moves to the newly selected one.

In Git itself, there is no base branch concept. This was answered in What is the base branch when a new one is created?

The default branch is master (you will be on this branch after a clone or when browsing a repository). In Bitbucket you can change the default branch in the Repository Settings screen.

When you git checkout -b mybranch, mybranch becomes the default branch. You always have to supply a target branch as there is no other branch object to reference. You can set up aliases or bash functions to create the same functionality as 'Base Branch', supplying a default target branch, on the command line.

Why "base branch" exists... Depending on you branching model, if you are doing a quarterly release, you may be doing the majority of your feature development against a long-lived branch q2-release for example. As features are merged into q2-release, you will want to diff to that branch instead of master. A diff against master may be unhelpful as it was the last quarter's release and missing the current changes for the next release candidate.

Related