如何在VSTS Git中强制实施工作项关联检查策略?
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.,
mainormaster), 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

