简体   繁体   中英

Git: how can I retrieve all branches that are protected?

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.

I looked at git branch command, but I didn't see anything there that could tell me whether a branch is protected or not.

You can use the GitLab API for listing protected branches .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM