blob: a9c80c0c517810574be568c7e8fec2a406d38399 (
plain)
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
|
########
Branches
########
References
----------
* v4 API:
+ :class:`gitlab.v4.objects.ProjectBranch`
+ :class:`gitlab.v4.objects.ProjectBranchManager`
+ :attr:`gitlab.v4.objects.Project.branches`
* GitLab API: https://docs.gitlab.com/ce/api/branches.html
Examples
--------
Get the list of branches for a repository::
branches = project.branches.list()
Get a single repository branch::
branch = project.branches.get('main')
Create a repository branch::
branch = project.branches.create({'branch': 'feature1',
'ref': 'main'})
Delete a repository branch::
project.branches.delete('feature1')
# or
branch.delete()
Delete the merged branches for a project::
project.delete_merged_branches()
To manage protected branches, see :doc:`/gl_objects/protected_branches`.
|