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.
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.repository
read:repository:bitbucket
string
Requiredstring
RequiredThe branching model object
allOf [object, Branching Model]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's branching model
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'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
"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"
}
}
}
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.
repository:admin
admin:repository:bitbucket
string
Requiredstring
RequiredThe branching model configuration
allOf [object, Branching Model Settings]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's branching model settings
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'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"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"
}
}
}
Update the branching model configuration for a repository.
The development
branch can be configured to a specific branch or to
track the main branch. When set to a specific branch it must
currently exist. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
development
property will leave the development branch unchanged.
It is possible for the development
branch to be invalid. This
happens when it points at a specific branch that has been
deleted. This is indicated in the is_valid
field for the branch. It is
not possible to update the settings for development
if that
would leave the branch in an invalid state. Such a request will be
rejected.
The production
branch can be a specific branch, the main
branch or disabled. When set to a specific branch it must currently
exist. The enabled
property can be used to enable (true
) or
disable (false
) it. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
production
property will leave the production branch unchanged.
It is possible for the production
branch to be invalid. This
happens when it points at a specific branch that has been
deleted. This is indicated in the is_valid
field for the branch. A
request that would leave production
enabled and invalid will be
rejected. It is possible to update production
and make it invalid if
it would also be left disabled.
The branch_types
property contains the branch types to be updated.
Only the branch types passed will be updated. All updates will be
rejected if it would leave the branching model in an invalid state.
For branch types this means that:
It is possible to store an invalid prefix if that branch type would be
left disabled. Only the passed properties will be updated. The
properties not passed will be left unchanged. Each branch type must
have a kind
property to identify it.
There is currently a side effect when using this API endpoint. If the repository is inheriting branching model settings from its project, updating the branching model for this repository will disable the project setting inheritance.
We have deprecated this side effect and will remove it on 1 August 2022.
repository:admin
admin:repository:bitbucket
string
Requiredstring
RequiredThe updated branching model configuration
allOf [object, Branching Model Settings]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's branching model settings
1
2
3
4
curl --request PUT \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/branching-model/settings' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"development": {
"use_mainbranch": true
},
"production": {
"enabled": true,
"use_mainbranch": false,
"name": "production"
},
"branch_types": [
{
"kind": "bugfix",
"enabled": true,
"prefix": "bugfix/"
},
{
"kind": "feature",
"enabled": true,
"prefix": "feature/"
},
{
"kind": "hotfix",
"prefix": "hotfix/"
},
{
"kind": "release",
"enabled": false
}
]
}
repository
read:repository:bitbucket
string
Requiredstring
RequiredThe effective branching model object
allOf [object, Effective Repository Branching Model]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's effective branching model
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/effective-branching-model' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"type": "<string>",
"branch_types": [
{
"kind": "feature",
"prefix": "<string>"
}
],
"development": {
"branch": {
"type": "<string>"
},
"name": "<string>",
"use_mainbranch": true
},
"production": {
"branch": {
"type": "<string>"
},
"name": "<string>",
"use_mainbranch": true
}
}
Return the branching model set at the project level. This view is read-only. The branching model settings can be changed using the settings API.
The returned object:
development
property. development.name
is
the user-specified branch that can be inherited by an individual repository's
branching model.production
property. production
will not
be present when production
is disabled.
production.name
is the user-specified branch that can be
inherited by an individual repository's branching model.branch_types
array which contains all enabled branch
types.project:admin
read:repository:bitbucket
string
Requiredstring
RequiredThe branching model object
allOf [object, Project Branching Model]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A project's branching model
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/branching-model' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"development": {
"name": "master",
"use_mainbranch": true
},
"production": {
"name": "production",
"use_mainbranch": false
},
"branch_types": [
{
"kind": "release",
"prefix": "release/"
},
{
"kind": "hotfix",
"prefix": "hotfix/"
},
{
"kind": "feature",
"prefix": "feature/"
},
{
"kind": "bugfix",
"prefix": "bugfix/"
}
],
"type": "project_branching_model",
"links": {
"self": {
"href": "https://api.bitbucket.org/.../branching-model"
}
}
}
Return the branching model configuration for a project. 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.
project:admin
admin:project:bitbucket
string
Requiredstring
RequiredThe branching model configuration
allOf [object, Branching Model Settings]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's branching model settings
1
2
3
4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/branching-model/settings' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"development": {
"name": "null",
"use_mainbranch": true
},
"production": {
"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"
}
}
}
Update the branching model configuration for a project.
The development
branch can be configured to a specific branch or to
track the main branch. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
development
property will leave the development branch unchanged.
The production
branch can be a specific branch, the main
branch or disabled. Any branch name can be supplied, but will only
successfully be applied to a repository via inheritance if that branch
exists for that repository. The enabled
property can be used to enable (true
)
or disable (false
) it. Only the passed properties will be updated. The
properties not passed will be left unchanged. A request without a
production
property will leave the production branch unchanged.
The branch_types
property contains the branch types to be updated.
Only the branch types passed will be updated. All updates will be
rejected if it would leave the branching model in an invalid state.
For branch types this means that:
It is possible to store an invalid prefix if that branch type would be
left disabled. Only the passed properties will be updated. The
properties not passed will be left unchanged. Each branch type must
have a kind
property to identify it.
project:admin
admin:project:bitbucket
string
Requiredstring
RequiredThe updated branching model configuration
allOf [object, Branching Model Settings]
Base type for most resource objects. It defines the common type
element that identifies an object's type. It also identifies the element as Swagger's discriminator
.
A repository's branching model settings
1
2
3
4
curl --request PUT \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace}/projects/{project_key}/branching-model/settings' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"development": {
"use_mainbranch": true
},
"production": {
"enabled": true,
"use_mainbranch": false,
"name": "production"
},
"branch_types": [
{
"kind": "bugfix",
"enabled": true,
"prefix": "bugfix/"
},
{
"kind": "feature",
"enabled": true,
"prefix": "feature/"
},
{
"kind": "hotfix",
"prefix": "hotfix/"
},
{
"kind": "release",
"enabled": false
}
]
}
Rate this page: