You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VSTS Git中强制实施工作项关联检查策略?

How to Enforce Work Item Linking for Git Commits in Azure DevOps (Formerly VSTS)

Got it, let's sort this out for you! Unlike TFVC, Azure DevOps Git doesn't use the classic "check-in policies" you might be familiar with. Instead, you'll use branch policies to enforce that every commit pushed to your target branch is linked to a work item. Here's a step-by-step guide:

  • First, navigate to your Azure DevOps project, then go to Repos > Branches.
  • Locate the branch you want to enforce this rule on (e.g., main or master), click the ellipsis (...) next to the branch name, and select Branch policies.
  • On the branch policies page, scroll down to the Work item linking section.
  • Check the box labeled Require a work item to be linked for all commits.
    • Optional: If you need to allow exceptions for specific users or groups, you can configure that here, but for strict enforcement, leave exceptions disabled.
  • Save your changes, and you're done!

From now on, any commit pushed to this branch (whether directly or via a pull request) must be linked to a work item. You can link work items either by including the work item ID in your commit message (e.g., Fix login bug #123) or by manually associating the work item when pushing. If a commit doesn't have a linked work item, the push will be rejected until you fix it.

内容的提问来源于stack exchange,提问作者Shubh Rocks Goel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:32:45