简体   繁体   English

git 的 bitbucket 版本中的基本与默认分支

[英]Base vs default branch in bitbucket version of git

Why there exists two different types of branches, base and default in Bitbucket?为什么 Bitbucket 中存在两种不同类型的分支,base 和 default? In my mind I understand that the master branch most of the times should be the default branch, ie the branch that everyone in the team should use as a reference and as also the branch that "guidelines" the development.在我看来,我理解 master 分支大多数时候应该是默认分支,即团队中的每个人都应该用作参考的分支,也是“指导”开发的分支。 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. 在Bitbucket中, 基本分支是您从分支列表中选择的最后一个分支。 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. 在Git本身,没有基本分支概念。 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). 默认分支master (在克隆或浏览存储库后,您将在此分支上)。 In Bitbucket you can change the default branch in the Repository Settings screen. 在Bitbucket中,您可以在“存储库设置”屏幕中更改默认分支。

When you git checkout -b mybranch , mybranch becomes the default branch.当您git checkout -b mybranchmybranch成为默认分支。 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.您可以设置别名或 bash 函数来创建与“基本分支”相同的功能,在命令行上提供默认目标分支。

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.为什么“基础分支”存在...根据您的分支模型,如果您进行季度发布,您可能会针对长期存在的分支q2-release进行大部分功能开发。 As features are merged into q2-release , you will want to diff to that branch instead of master .随着功能合并到q2-release ,您将需要 diff 到该分支而不是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.master的差异可能没有帮助,因为它是上个季度的版本,并且缺少下一个候选版本的当前更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM