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.
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.
The default branch is also the initial branch that Git checks out locally when someone clones the repository. Unless you specify a different branch, the default branch in a repository is the base branch for new pull requests and code commits. By default, GitHub names the default branch main in any new repository.
The default branch for a repository is its integration branch for work.
The base branch is used to how many commits other branches are ahead/behind the "base branch", and if you change the base branch the ahead/behind numbers will change.
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.
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