Skip to content
Source
Sign inSign up

Link the issues it fixes

Issues and pull requests / Pull requests

Link the issues a pull request fixes

You open a pull request for an issue. You want the issue to close when the fix merges, and you want people who read the issue to see the pull request.

4 min read

Link the issue to the pull request. The link shows on both pages, and the merge closes the issue.

You need to be the author of the pull request, or to have triage access, to change its links.

Push your branch. Then, in your clone, run:

src pr create --fill --fixes 12
  • --fixes takes one or more issue numbers, such as --fixes 12,13 or --fixes "#12". You can give the flag more than one time.
  • A closing keyword in the title or the body links the issue too: Fixes #12, Closes #12 or Resolves #12, in upper or lower case. This is also true for a pull request that GitHub sync brings in.
  • One pull request fixes 50 issues at most.

Important

Each number of --fixes must be an issue of this repository that you can read. If a number is a pull request or no issue, the forge refuses it and opens no pull request. A keyword that names such a number links nothing.

In a terminal:

src pr edit 7 --add-fixes 12
src pr edit 7 --remove-fixes 13

On the web:

  1. Open the pull request.
  2. On the Status tab of the right column, find the Fixes row of the Details card. Click its pencil.
  3. Type the issue numbers, for example 12, 13. Then click Link.
  4. To remove a link, click the x next to the issue.

When an edit adds a closing keyword to the title or the body, the forge links that issue. When you remove the keyword, the link stays. Remove it with --remove-fixes.

  • The Fixes row of the pull request lists the issues, each with its state.
  • The sidebar of the issue lists the pull requests that fix it, under Pull requests.
  • The list of issues shows, on each issue, the open pull requests that fix it and that you can read.
  • Each change of a link adds a line to the timeline of the pull request and of the issue.

In the list of issues, one pull request shows as a link, such as #7, with its title on hover. Two or more show a count: click it to see the links. Merged and closed pull requests do not show, and the row changes live when one closes, merges or reopens.

In a terminal:

src pr view 7 --json closingIssuesReferences
src issue view 12 --json closedByPullRequestsReferences

4. Merge

When the pull request merges into the default branch, the forge closes each open issue that it fixes. The timeline of the issue says "closed this with #7".

Done

Your pull request names the issues that it fixes. People who open the issue see the pull request, and the merge closes the issue without a manual step.

Later: REST and MCP

An agent or a script links issues over REST or MCP, with the same rules. The REST paths are under /api/v1/repos/{owner}/{repo}.

You want toRESTMCP tool
Link issues when you open the pull requestPOST /pulls, with "fixes": [12]create_pull_request, with fixes
Make a list the exact linksPUT /pulls/{n}/fixes, with { "issues": [12, 13] }set_pull_fixes, with mode: "set"
Add linksPOST /pulls/{n}/fixes, with { "issues": [12] }set_pull_fixes, with mode: "add"
Remove a linkDELETE /pulls/{n}/fixes/{issue}set_pull_fixes, with mode: "remove"
Read the linksGET /issues/{n}get_issue

GET /issues/{n} of a pull request has fixes, the issues that it fixes. For an issue, it has fixedBy, the pull requests that fix it, and staged.

The token of a CI job cannot change links.