[英]Can we lock a file in Azure DevOps?
I know that we can lock a branch in Azure Repos so that users can't push changes to it.我知道我们可以在 Azure Repos 中锁定一个分支,这样用户就无法将更改推送到它。 Can we lock a particular file inside the branch so that it cannot be changed by other users?
我们可以锁定分支内的特定文件,使其不能被其他用户更改吗?
Or can this be done in visual studio - team explorer?或者这可以在视觉工作室 - 团队资源管理器中完成吗? My current source control plugin is Git.
我目前的源代码管理插件是 Git。
No, this is not provided by Git (maybe through Git-LFS only).不,这不是由 Git 提供的(可能仅通过 Git-LFS)。
And not exposed by Azure.并且不会被 Azure 暴露。
Azure only reference the .gitignore file , but does not mention any file locking mechanism. Azure 仅引用.gitignore 文件,但未提及任何文件锁定机制。
You could lock the branch, require reviewers, automatically add the user responsible for the file you want locked as a reviewer when the file is modified (under "automatically include code reviewers"), and set the policy as "required".您可以锁定分支,要求审阅者,在修改文件时自动添加负责您要锁定的文件的用户作为审阅者(在“自动包含代码审阅者”下),并将策略设置为“必需”。
That way no pull request including a change on the locked file can be accepted without the user responsible for the file approving it.这样,在没有负责文件的用户批准的情况下,不能接受包括更改锁定文件的拉取请求。
As Sacha K said, you can set up a policy that protects a single file, and you can specify a reviewer.正如 Sacha K 所说,您可以设置保护单个文件的策略,并且可以指定审阅者。 You can also specify that an impossible number of reviewers are required to change that file, like 999. And you can put in the "Activity feed message" that the file is locked and must not be changed.
您还可以指定更改该文件所需的审阅者数量是不可能的,例如 999。并且您可以输入文件已锁定且不得更改的“活动提要消息”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.