Base vs default branch in bitbucket version of git

18,711

Solution 1

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.

Solution 2

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.

Share:
18,711

Related videos on Youtube

pebox11
Author by

pebox11

Updated on October 26, 2022

Comments

  • pebox11
    pebox11 over 1 year

    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.

  • pebox11
    pebox11 over 4 years
    Adding to dokaspar's nice answer, it also seems that defining a base branch can give you at a given time a different view with respect to how much Behind/Ahead are the rest of your branches according to your defined base branch at that given time.