Bitbucket Server でブランチを使用する




アトラシアン コミュニティをご利用ください。


Bitbucket Server makes it easy for each member of your team to use a branching workflow for your Git development process. Your workflow can be mapped to branches in the Bitbucket Server 'branching model', allowing Bitbucket Server to:

  • guide your developers into making consistent naming decisions when creating branches.
  • identify the type of each branch and apply actions like automatic merging accordingly.


See also  Using branch permissions for information about restricting access to branches in Bitbucket Server.

Configuring the branching model

Bitbucket Server uses a 'branching model' to define the branch workflow for each repository. As a project administrator, configuring the model lets you:

  • enable the branch types that will be available in your workflow.
  • specify the naming convention to be used for each branch type. 

The naming convention simply adds prefixes to branch names, so that branches of the same type get the same prefix.

A Bitbucket Server admin can configure the branching model for a repository, by going to Settings > Branching model for the repository and clicking Enable branching model. Note that for new repositories, the branching model is enabled by default, and uses the default branch prefixes.

Bitbucket Server makes a number of branch types available, as described below. Use the checkboxes to enable just those branch types that map to your workflow. Note that several branch types have default branch naming prefixes (for example the default prefix for the 'feature' branch type is feature/), as shown:


This is generally the integration branch for feature work and is often the default branch (e.g. master) or a named branch such as develop. In a workflow using pull requests, this is usually the branch where new feature branches are targeted. In other cases, developers might commit directly to this branch.



Feature branches are used for specific feature work or improvements. They generally branch from, and merge back into, the development branch, by means of pull requests. See Feature branch workflow.



The production branch is used while deploying a release. It branches from, and merges back into, the development branch. In a Gitflow-based workflow it is used to prepare for a new production release. 



Release branches are used for release task and long-term maintenance of software versions. Typically, they branch from, and fixes are merged back into, the development branch. Merging into an older release branch allows for automatic merging to newer release branches as well as the development branch.



Bugfix branches are typically used to fix release branches.  



Hotfix branches are used to quickly fix the production branch without interrupting changes in the development branch. In a Gitflow-based workflow, changes are usually merged into the production and development branches.



  • Prefixes can't be empty.
  • Prefixes can't be longer that 30 characters.
  • Prefixes can't overlap; for example PROD and PRODUCT would be overlapping prefixes.
  • For Bitbucket Server instances using Microsoft SQL Server, prefixes can't use non-ASCII characters. See  STASH-3884 - Getting issue details... STATUS .

Creating branches

You can create a new branch when in JIRA Software (version 6.1 and above) or in Bitbucket Server. Either way, you can override the settings that Bitbucket Server suggests for the repository, branch type, branching point and branch name.

Create a branch from a JIRA Software issue

(info) JIRA Software must be connected with Bitbucket Server by an application link for this functionality to be available.

When viewing an issue in JIRA Software, click Create Branch (under 'Development' – you'll need the 'View Development Tools' project permission within JIRA Software to see this):

利用可能な SCM が複数ある場合はブランチを作成する SCM を選択します。

Bitbucket Server suggests the Branch type and Branch name based on the JIRA Software issue type and summary. Change the settings suggested by Bitbucket Server, if necessary:

Create a branch from within Bitbucket Server

Bitbucket Server で、サイドバーから [ブランチを作成] を選択します。

Bitbucket Server will suggest the Branch type and Branch name based on the JIRA Software issue type and summary. Notice that Bitbucket Server displays the current build status beside the source branch picker. Change the settings suggested by Bitbucket Server if necessary:

Creating the branch

You can specify:

  • リポジトリ
  • the Branch type, if a branching model has been previously configured – choose Custom if you need an ad hoc branch type
  • the Branch from point – you can choose either a branch or a tag.
  • the Branch name – the prefix is based on the branch type you selected, and as defined by the branching model. Note that the branch name should follow your team's convention for this.

Note that Bitbucket Server suggests a Branch type based on the JIRA Software issue type, when a branching model is configured. The mapping is:

Jira Software の課題タイプ Bitbucket Server のブランチ タイプ
バグ Bugfix
ストーリー 機能
新機能 機能

新しいブランチが作成されると、Bitbucket はファイルの一覧を表示します。これで、ローカル リポジトリへのプルを行い、新しいブランチに切り替えることができます。

ブランチ ワークフローの自動化

Bitbucket Server ではリポジトリのブランチ モデルに基づき、ブランチ ワークフローで一部のマージを自動化することができます。これにより、いくつかの条件を満たした場合にマージを同じ親の新しいブランチにカスケードし、ブランチの手動メンテナンスを軽減できます。

As a project administrator you can turn on automatic merging for a particular repository. Go to Settings > Branching model for the repository, and select Enable automatic merging  (under 'Automatic merge').

If Bitbucket Server cannot perform an automatic merge, perhaps because branch permissions prevent it, Bitbucket Server creates a new pull request for that merge, and the automatic merge operation stops, This allows you to resolve the conflict locally before approving the new pull request, which may involve further cascading merges.

自動マージの条件、および Bitbucket Server でのブランチ順の判断基準の詳細は、「自動ブランチ マージ」を参照してください。

Managing all your branches

The branch listing page makes it easy to keep track of all the branches in your repository.

Searching for branches

You can easily find branches by using the search at the top of the table. Furthermore, if you're using the Bitbucket Server branch model, you can filter by branch type simply by searching for the prefix – for example, search for "feature/" to see all your feature branches.

You can find the feature and bugfix branches that haven't yet been merged into a particular release (for example, "release/2.10") by changing the 'base branch' – just use the branch selector (arrowed in the screenshot below) to change the base branch, and refer to the Behind/Ahead and Pull requests columns.

Reading the table

後 / 前

The Behind/Ahead column shows by how many commits a branch has diverged from the 'base branch' (for example, master). Use the branch selector (arrowed in the screenshot below) to change the base branch.


The Pull requests column shows the most relevant status from the pull requests against each branch – click an icon to see details. The status is: 

  • OPEN: オープンなプル リクエストが 1 つ以上ある場合
  • MERGED: オープンなプル リクエストがなく、1 つ以上のプル リクエストがマージ済みの場合
  • DECLINED: オープンまたはマージ済みのプル リクエストがなく、1 つ以上のプル リクエストが却下された場合


If you have an integrated build server, the Builds column shows the status of the latest build results published to Bitbucket Server. The overall status is 'passed' if all the different builds (for example, unit tests, functional tests, deploy to staging) succeeded and 'failed' if at least one run failed for any of those. Click an icon to see details of the builds.


The Actions menus include tasks for working with branches:

  • Check out in SourceTree
  • プル リクエストを作成する
  • Edit permissions
  • Delete branch

Choose Keyboard shortcuts from the Bitbucket Server Help menu to see shortcuts to help you navigate quickly around the branch listing.

Checking on your branches


  • 自身のブランチと選択した "ベース ブランチ" とを比較して、自身のブランチのコミットがいくつ進んで / 遅れているかを確認する
  • ブランチを起点とするプル リクエストの最新のステータスを確認する。
  • ブランチのビルド ステータスを一目で確認
  • The Pull requests status helps you to track the review and merge work that still needs to be done and can help with branch cleanup. For example, in combination with the Behind/Ahead information, you can decide whether to remove a feature branch that has already been merged.
  • The Behind/Ahead column can help you to identify work in progress as well as stale branches. It is calculated for each branch against the base branch.


最終更新日: 2015 年 9 月 6 日




Powered by Confluence and Scroll Viewport.