GIT:如何保护分支免遭其他开发人员删除? [英] GIT: How to protect the branch from being removed by other developers?

查看:77
本文介绍了GIT:如何保护分支免遭其他开发人员删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的产品首次发布之后,我们将切换到不同的分支机构进行主要开发和功能开发.有没有办法以这种方式创建分支,以便除非您是特定用户(基于角色或用户名),否则我们可以防止它被删除(意外或有意地)?

After the first release of our product, we will be switching to a different branches for the main development and feature development. Is there a way to create a branch in such a way, so that we can protect it from being removed (accidentally or on purpose) unless you're a specific user (based on role or username)?

我试图在本地gitlab机器上创建一个示例git存储库,然后通过网站上的选项保护其中一个分支,但是后来我可以使用 git push origin:branch_name .预先感谢!

I tried to create a sample git repository in our local gitlab machine, then protected one of the branches from the option on the website, but then I was able to remove it with git push origin :branch_name. Thanks in advance!

该解决方案是否可以在github.com上使用?

Will the solution work on github.com?

推荐答案

有很多方法可以解决此问题:

There are many ways to tackle this:

  1. 进行另一个存储库,即沙箱,并授予对主存储库的只读访问权限.如果他们意外删除,则可以从主存储库中获取分支.假设您只使用github作为仓库,而没有本地dev仓库.
  2. 除非您是特定用户,否则存储库中的设置挂钩不允许删除分支.您无法在github上执行此操作,因为它们不允许在其服务器上执行任意代码.如果您获得本地存储库,则可以执行此操作.
  3. 设置本地gitolite安装以管理具有权限的分支.

这篇关于GIT:如何保护分支免遭其他开发人员删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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