summaryrefslogtreecommitdiff
path: root/docs/gl_objects/branches.rst
blob: 1b61af34c97815a5edbaa014c74f6295956b3c75 (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
43
########
Branches
########

Use :class:`~gitlab.objects.ProjectBranch` objects to manipulate repository
branches.

To create :class:`~gitlab.objects.ProjectBranch` objects use the
:attr:`gitlab.Gitlab.project_branches` or :attr:`Project.branches
<gitlab.objects.Project.branches>` managers.

Examples
========

Get the list of branches for a repository:

.. literalinclude:: branches.py
   :start-after: # list
   :end-before: # end list

Get a single repository branch:

.. literalinclude:: branches.py
   :start-after: # get
   :end-before: # end get

Create a repository branch:

.. literalinclude:: branches.py
   :start-after: # create
   :end-before: # end create

Delete a repository branch:

.. literalinclude:: branches.py
   :start-after: # delete
   :end-before: # end delete

Protect/unprotect a repository branch:

.. literalinclude:: branches.py
   :start-after: # protect
   :end-before: # end protect