简体   繁体   English

我们可以在 Azure DevOps 中锁定文件吗?

[英]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.

相关问题 我们可以从 Azure Devops 管道提出并合并拉取请求吗? - Can we raise and merge a pull request from Azure Devops pipelines? 我们如何在 Azure DevOps 中完全关闭一个工作项? - How do we fully close a work item in Azure DevOps? 如何将克隆的 git 存储库 zip 文件添加到 Azure devops? - How can i add a cloned git repository zip file to Azure devops? 如何排除对管道 yaml 文件的更改以触发构建 i azure devops? - How can I exclude changes to the pipeline yaml file to trigger a build i azure devops? 在使用 php curl 将文件上传到 Azure DevOps Git 之前如何获取 oldObjectId? - How can I get oldObjectId before uploading a file to Azure DevOps Git using php curl? 如何在同一存储库中的自述文件 markdown 文件中显示(链接到/超链接)Azure DevOps Git 存储库中的图像? - How can I display (link to/hyperlink) images that are in an Azure DevOps Git repo in a README markdown file in the same repo? 无法在 Azure DevOps 上完成拉取请求 - Can't complete a Pull request on Azure DevOps 无法在 Azure DevOps 上完成拉取请求 - Can't complete pull request on Azure DevOps Git 无法在 Azure DevOps 中创建标签 - Git can't create tag in Azure DevOps 为什么我不能将我的 Azure DevOps 存储库导入到新的 Azure DevOps 存储库? - Why can't I import my Azure DevOps repo to a new Azure DevOps repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM