GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-gitlab/docs/gl_objects/branches.rst at main · netflash/python-gitlab

Expand file tree

/

branches.rst

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (26 loc) · 852 Bytes
/

branches.rst

Copy path

File metadata and controls

42 lines (26 loc) · 852 Bytes
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

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/api/branches

Examples

Get the list of branches for a repository:

branches = project.branches.list(get_all=True)

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`.

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.