正解:
See explanation below
Explanation:
Step 1: Navigate to the Project1 Repository
* In your browser, go to your Azure DevOps organization:https://dev.azure.com/
{YourOrganizationName}
* In the left menu, select the project named Project1.
* In the left menu under Repos, click on Files.
Step 2: Initialize the Main Branch (if it doesn't exist)
If the main branch doesn't exist (because the repo is empty):
* In the Repos > Files view, you'll see a message: "This repository is empty."
* Click on the Initialize button.
* Choose the default branch name as main and create a README file (or any file to initialize).
* Click Initialize.
This creates the main branch in your repository.
Step 3: Set Up Branch Protection for the Main Branch
Branch protection ensures that all changes go through a pull request (PR), and that PRs are linked to work items (for traceability).
* In the Repos view, click on Branches in the left menu.
* Locate the main branch in the list.
* Click on the three dots (...) next to main and select Branch policies.
Step 4: Configure Branch Policies for main
In the Branch policies for the main branch:
* Require a minimum number of reviewers:
* Enable this option and set to 1 or more as per your team's standards.
* Check for linked work items:
* Enable the Check for linked work items option.
* This ensures that every PR has at least one linked work item.
* Require a linked work item:
* This enforces the traceability requirement you mentioned.
* Optionally, you can also:
* Enable build validation if you have a pipeline to validate builds.
* Enforce merge strategies (like squash merge).
* Click Save changes at the bottom.