Rate this page:
The branching model resource is used to modify the branching model for a repository. You can use the branching model to define a branch based workflow for your repositories. When you map your workflow to branch types, you can ensure that branches are named consistently by configuring which branch types to make available.
GET /2.0/repositories/{workspace}/{repo_slug}/branching-model
Return the branching model as applied to the repository. This view is read-only. The branching model settings can be changed using the settings API.
The returned object:
development
property. development.branch
contains
the actual repository branch object that is considered to be the
development
branch. development.branch
will not be present
if it does not exist.production
property. production
will not
be present when production
is disabled.
production.branch
contains the actual branch object that is
considered to be the production
branch. production.branch
will
not be present if it does not exist.branch_types
array which contains all enabled branch
types.Example body:
1 2{ "development": { "name": "master", "branch": { "type": "branch", "name": "master", "target": { "hash": "16dffcb0de1b22e249db6799532074cf32efe80f" } }, "use_mainbranch": true }, "production": { "name": "production", "branch": { "type": "branch", "name": "production", "target": { "hash": "16dffcb0de1b22e249db6799532074cf32efe80f" } }, "use_mainbranch": false }, "branch_types": [ { "kind": "release", "prefix": "release/" }, { "kind": "hotfix", "prefix": "hotfix/" }, { "kind": "feature", "prefix": "feature/" }, { "kind": "bugfix", "prefix": "bugfix/" } ], "type": "branching_model", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model" } } }
repository
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/branching-model' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
The branching model object
Content type | Value |
---|---|
application/json | allOf [object, Branching Model] |
GET /2.0/repositories/{workspace}/{repo_slug}/branching-model/settings
Return the branching model configuration for a repository. The returned object:
development
property for the development branch.production
property for the production branch. The
production branch can be disabled.branch_types
contains all the branch types.This is the raw configuration for the branching model. A client wishing to see the branching model with its actual current branches may find the active model API more useful.
Example body:
1 2{ "development": { "is_valid": true, "name": null, "use_mainbranch": true }, "production": { "is_valid": true, "name": "production", "use_mainbranch": false, "enabled": false }, "branch_types": [ { "kind": "release", "enabled": true, "prefix": "release/" }, { "kind": "hotfix", "enabled": true, "prefix": "hotfix/" }, { "kind": "feature", "enabled": true, "prefix": "feature/" }, { "kind": "bugfix", "enabled": false, "prefix": "bugfix/" } ], "type": "branching_model_settings", "links": { "self": { "href": "https://api.bitbucket.org/.../branching-model/settings" } } }
repository:admin
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/branching-model/settings' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'