Rediger

Del via


Drive Git development from a work item in Azure Boards

Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022

Link work items to branches, commits, pull requests, and builds so your team can trace every code change back to a planned task. When you create a branch from a work item, Azure Boards links them automatically.

This article walks through creating branches, linking commits, and managing pull requests in an Azure DevOps Git repository. For GitHub repositories, see Link GitHub commits and pull requests to work items.

Tip

Set up automatic linking so work items stay connected to commits, pull requests, and builds without manual effort:

Tip

You can use AI to help with this task later in this article, or see Enable AI assistance with Azure DevOps MCP Server to get started.

Development control

The Development control on the work item form displays linked branches, commits, pull requests, and builds in one place. From this control, you can create branches or pull requests and navigate directly to any linked artifact.

Screenshot of work item form, Development control.

Note

The Development control appears only in the web portal. Visual Studio and other clients don't include it.

Prerequisites

Category Requirements
Project access Project member.
Permissions Member of the Contributors or Project Administrators group.
Work item access View work items in this node and Edit work items in this node set to Allow. The Contributors group has this permission by default. For more information, see Set permissions and access for work tracking.

Create a branch, make changes, and submit a pull request

  1. In the Development section of the work item, select Create a branch.

    Screenshot of Development control, Create branch link.

    Alternatively, select Actions > New branch.

    Screenshot shows User story work item form, Action menu, add new branch.

  2. Name the branch, select the repository, and select Create branch.

    Screenshot shows Create a branch dialog box.

    The branch links to the work item automatically, and the repository opens to the new branch.

    Note

    The main branch must contain at least one file before you can create a branch. Each new project includes a README file in the initial repo.

  3. Edit files in the web portal, or clone the repo and work locally in Visual Studio or another IDE. For more information, see Download changes with fetch.

  4. Commit and push your changes to the repository.

    Screenshot shows Commit and push changes.

    For a new branch, publish it before pushing. For more information, see Share code with push.

  5. In the Development section, create a pull request to merge your changes and start a code review.

    Screenshot shows Development control, Create pull request link.

  6. Complete the pull request on the Pull Requests page.

    Code view, Pull Request page.

    Note

    You can't create another pull request for the same branch until the current one completes.

    Screenshot shows Pull Request page, Create pull request.

    (Optional) Select Squash changes when merging, and then complete the merge.

    Screenshot shows Complete pull request dialog box, check squash-merge.

  7. A confirmation appears after the pull request completes.

    Screenshot shows Pull request, completed notification.

  8. Refresh the work item form and select Maximize Development to see links for the branch, commits, and pull request.

    Screenshot of Work item form, Development section, links added.

Create a branch for several work items

Use multi-select on the backlog or board to select multiple work items, and then create a branch that links to all of them at once.

Screenshot of select multiple items from backlog, Create branch link.

Specify the branch name in the dialog.

Screenshot shows Create new branch dialog.

Development links also appear on the Links and History tabs of the work item form.

Screenshot shows Links tab, development links.

To link a work item to an existing branch, commit, build, or other object, select Add link and choose the link type.

Screenshot shows select Add links icon and then choose the link type.

In the Development section, select the link and select Remove link .

Screenshot shows Development section, delete a link.

On the Links tab, select Actions > Remove link for the link.

Associated work items in build

The build summary page shows work items linked to Git commits under Associated work items.

Linked work items listed under Associated work items in the build summary page.

Links appear in the Development section when you:

  • Create a branch, commit, or pull request from the work item
  • Reference the work item ID in a commit, pull request, or other Git or TFVC operation
  • Manually add a link from the Development section or Links tab

Supported link types include Branch, Build, Changeset, Commit, Found in build, Integrated in build, Pull Request, and Versioned Item.

Tip

Integrated in build also works for GitHub repositories with YAML pipelines. For more information, see View build status for YAML pipelines.

Screenshot shows Artifact-to-artifact link types.

If you connect the Azure Boards MCP Server to your AI agent in agent mode, you can use natural language prompts to manage links between work items and development objects.

Task Example prompt
Link a work item to a PR Add a pull request link from user story #234 to pull request #567
Find linked work items Show me all work items that have pull request links in the current sprint
Check development status List all user stories in the Active state that don't have any development links
View links for a work item Show me all links for work item #890, including commits and pull requests
Find unlinked PRs Which open pull requests in the FabrikamFiber repo aren't linked to any work item?
Summarize recent commits Summarize the commits linked to bug #452 and tell me if the fix looks complete
Trace a feature end-to-end Show me every branch, PR, and build linked to feature #100 and its child user stories

Note

Agent mode and the MCP Server use natural language, so you can adjust these prompts or ask follow-up questions to refine the results.