Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Base vs default branch in bitbucket version of git

Tags:

git

bitbucket

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.

like image 527
pebox11 Avatar asked Dec 21 '18 18:12

pebox11


People also ask

What is base branch and default branch in Bitbucket?

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.

What is base branch and default branch in Git?

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.

What is the default branch in Bitbucket?

The default branch for a repository is its integration branch for work.

What does base branch mean in Git?

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.


Video Answer


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.

like image 200
dokaspar Avatar answered Oct 08 '22 14:10

dokaspar


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.

like image 29
Sean Blanton Avatar answered Oct 08 '22 13:10

Sean Blanton