什么是受保护的git分支? [英] What is protected git branch?

查看:1439
本文介绍了什么是受保护的git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GIT和分支的新手,最近我看到受保护的分支,这意味着什么,以及我们如何保护分支?

I am new with GIT and branching and recently I saw protected branch, what does that mean and how do we protect a branch?

推荐答案

它不是git的功能,而是Github和其他代码托管站点的功能。

It's not a feature of git but a feature of Github and other code hosting sites. It allows you to protect specific branches from unauthorized modification.

这是Github文档:


受保护的分支确保您存储库中的协作者无法
对分支进行不可撤销的更改。这些分支机构也可以通过要求合并请求之前必须经过至少一个批准的
审查而受到
的保护。

Protected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. These branches can also be protected by requiring pull requests to have at least one approved review before they can be merged.

如果您拥有一个具有多个创建
分支并打开拉取请求的协作者的存储库,您可能需要强制执行
分支保护以保持您的项目和拉取请求的组织性和安全性。

If you own a repository with multiple collaborators who create branches and open pull requests, you may need to enforce branch protections to keep your project and pull requests organized and safe.

受保护的分支在
存储库管理员选择保护的分支上阻止了Git的某些功能。受保护的分支:

Protected branches block several features of Git on a branch that a repository administrator chooses to protect. A protected branch:

不能被强制按下

不能删除

在通过必要的状态检查之前不能将更改合并到其中

Can't have changes merged into it until required status checks pass

在进行必要的检查之前不能将更改合并到其中批准的
无法编辑或从Web上载文件

Can't have changes merged into it until required reviews are approved Can't be edited or have files uploaded to it from the web

在将具有指定名称的文件更改之前,不能将更改合并到其中代码所有者已被该所有者批准
如果您的存储库属于某个组织,则可以限制用户或团队推送到受保护的分支。

Can't have changes merged into it until changes to files that have a designated code owner have been approved by that owner If your repository belongs to an organization, you can restrict users or teams from pushing to a protected branch.

具体细节因您使用的网站而异。

The specific details will vary depending on the website you use.

这篇关于什么是受保护的git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆