Article version: GitHub.com
Linking a pull request to an issue
You can link a pull request to an issue to show that a fix is in progress and to automatically close the issue when the pull request is merged.
You can link an issue to a pull request manually or using a supported keyword in the pull request description.
When you link a pull request to the issue the pull request addresses, collaborators can see that someone is working on the issue.
When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed. For more information about the default branch, see "Setting the default branch."
Anyone with write permissions to a repository can manually link a pull request to an issue.
You can manually link up to ten issues to each pull request. The issue and pull request must be in the same repository.
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Pull requests.
- In the list of pull requests, click the pull request that you'd like to link to an issue.
- In the right sidebar, click Linked issues.
- Click the issue you want to link to the pull request.
You can link a pull request to an issue by using a supported keyword in the pull request's description.
The syntax for closing keywords depends on whether the issue is in the same repository as the pull request.
|Issue in the same repository||KEYWORD #ISSUE-NUMBER|
|Issue in a different repository||KEYWORD OWNER/REPOSITORY#ISSUE-NUMBER|
|Multiple issues||Use full syntax for each issue|
Only manually linked pull requests can be manually unlinked. To unlink an issue that you linked using a keyword, you must edit the pull request description to remove the keyword.
You can also use closing keywords in a commit message. The issue will be closed when you merge the commit into the default branch, but the pull request that contains the commit will not be listed as a linked pull request.