A branch is essentially a unique set of code changes with a unique name.
gitlab_branch table can be used to query information about any branch.
However, you must specify a
project_id in the where or join clause.
select*fromgitlab_branchwhereproject_id = 1;
Get branch information for a specific set of projects
selectp.name as project_name,p.full_path as project_path,b.name as branch_name,b.default as is_default_branch,b.commit_short_id as commit_hashfromgitlab_branch binner joingitlab_my_project ponb.project_id = p.idwhere b.project_id in (selectidfromgitlab_my_projectwherefull_path like '%service%');
Branches in the given project.
|can_push||boolean||Indicates if the current user can push to this branch.|
|commit_date||timestamp without time zone||The date of the latest commit on the branch.|
|commit_email||text||The email address associated with the latest commit on the branch.|
|commit_id||text||The latest commit hash on the branch.|
|commit_short_id||text||The latest short commit hash on the branch.|
|commit_title||text||The title of the latest commit on the branch.|
|default||boolean||Indicates if the branch is the default branch of the project.|
|devs_can_merge||boolean||Indicates if users with the `developer` level of access can merge the branch.|
|devs_can_push||boolean||Indicates if users with the `developer` level of access can push to the branch.|
|merged||boolean||Indicates if the branch has been merged into the trunk.|
|name||text||The name of the branch.|
|project_id||bigint||The ID of the project containing the branches - link to `gitlab_project.ID`|
|protected||boolean||Indicates if the branch is protected or not.|
|web_url||text||The url of the branch.|