I want to be able to get all branches from a project that are protected. The protection is done in gitlab, so I wasn't sure if there's API exposed so I can get it from the command line.
我希望能够从受保护的项目中获取所有分支。保护是在gitlab中完成的,所以我不确定是否暴露了API,所以我可以从命令行获取它。
I looked at git branch
command, but I didn't see anything there that could tell me whether a branch is protected or not.
我看了一下git branch命令,但是我没有看到任何可以告诉我分支是否受到保护的东西。
1 个解决方案
#1
2
You can use the GitLab API for listing protected branches.
您可以使用GitLab API列出受保护的分支。
GET /projects/:id/protected_branches
From there, you can use in your local repo git config
or git notes
to leave a "marker" to your branches.
从那里,你可以在你的本地repo git配置或git笔记中使用,为你的分支留下一个“标记”。
#1
2
You can use the GitLab API for listing protected branches.
您可以使用GitLab API列出受保护的分支。
GET /projects/:id/protected_branches
From there, you can use in your local repo git config
or git notes
to leave a "marker" to your branches.
从那里,你可以在你的本地repo git配置或git笔记中使用,为你的分支留下一个“标记”。