{"meta":{"title":"Linking a pull request to an issue","intro":"You can link a pull request or branch to an issue to show that a fix is in progress and to automatically close the issue when the pull request or branch is merged.","product":"GitHub Issues","breadcrumbs":[{"href":"/en/issues","title":"GitHub Issues"},{"href":"/en/issues/tracking-your-work-with-issues","title":"Issues"},{"href":"/en/issues/tracking-your-work-with-issues/using-issues","title":"Using issues"},{"href":"/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue","title":"Link PR to issue"}],"documentType":"article"},"body":"# Linking a pull request to an issue\n\nYou can link a pull request or branch to an issue to show that a fix is in progress and to automatically close the issue when the pull request or branch is merged.\n\n## About linked issues and pull requests\n\nYou can link an issue to a pull request manually or using a supported keyword in the pull request description, that is, the summary text added by the author when they created the pull request.\n\nWhen you link a pull request to the issue the pull request addresses, collaborators can see that someone is working on the issue.\n\nWhen 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 [Changing the default branch](/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch).\n\n> \\[!NOTE]\n> The special keywords in a pull request description are interpreted only when the pull request targets the repository's *default* branch. If the pull request targets *any other branch*, then these keywords are ignored, no links are created, and merging the PR has no effect on the issues.\n\n## Linking a pull request to an issue using a keyword\n\nYou can link a pull request to an issue by using a supported keyword in the pull request's description or in a commit message. The pull request **must be** on the default branch.\n\n* `close`\n* `closes`\n* `closed`\n* `fix`\n* `fixes`\n* `fixed`\n* `resolve`\n* `resolves`\n* `resolved`\n\nIf you use a keyword to reference a pull request comment in another pull request, the pull requests will be linked. Merging the referencing pull request also closes the referenced pull request.\n\nThe syntax for closing keywords depends on whether the issue is in the same repository as the pull request.\n\n| Linked issue                    | Syntax                                | Example                                                        |\n| ------------------------------- | ------------------------------------- | -------------------------------------------------------------- |\n| Issue in the same repository    | KEYWORD #ISSUE-NUMBER                 | `Closes #10`                                                   |\n| Issue in a different repository | KEYWORD OWNER/REPOSITORY#ISSUE-NUMBER | `Fixes octo-org/octo-repo#100`                                 |\n| Multiple issues                 | Use full syntax for each issue        | `Resolves #10, resolves #123, resolves octo-org/octo-repo#100` |\n\nThe keywords can be followed by colons or in uppercase. For example: `Closes: #10`, `CLOSES #10`, or `CLOSES: #10`.\n\nOnly 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.\n\nYou 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.\n\n## Manually linking a pull request to an issue using the pull request sidebar\n\nAnyone with write permissions to a repository can manually link a pull request to an issue from the pull request sidebar.\n\nYou can manually link up to ten issues to each pull request. The issue and pull request must be in the same repository.\n\n1. On GitHub, navigate to the main page of the repository.\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-git-pull-request\" aria-label=\"git-pull-request\" role=\"img\"><path d=\"M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z\"></path></svg> Pull requests**.\n\n   ![Screenshot of the main page of a repository. In the horizontal navigation bar, a tab, labeled \"Pull requests,\" is outlined in dark orange.](/assets/images/help/repository/repo-tabs-pull-requests-global-nav-update.png)\n3. In the list of pull requests, click the pull request that you'd like to link to an issue.\n4. In the right sidebar, click **Development**.\n\n   ![Screenshot of the issue sidebar. \"Development\" is outlined in dark orange.](/assets/images/help/pull_requests/development-menu.png)\n5. Click the issue you want to link to the pull request.\n\n## Manually linking a pull request or branch to an issue using the issue sidebar\n\nAnyone with write permissions to a repository can manually link a pull request or branch to an issue from the issue sidebar.\n\nYou can manually link up to ten issues to each pull request. The issue can be in a different repository than the linked pull request or branch. Your last selected repository will be remembered.\n\n1. On GitHub, navigate to the main page of the repository.\n2. Under your repository name, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-issue-opened\" aria-label=\"issue-opened\" role=\"img\"><path d=\"M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z\"></path><path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z\"></path></svg> Issues**.\n\n   ![Screenshot of the main page of a repository. In the horizontal navigation bar, a tab, labeled \"Issues,\" is outlined in dark orange.](/assets/images/help/repository/repo-tabs-issues-global-nav-update.png)\n3. In the list of issues, click the issue that you'd like to link a pull request or branch to.\n4. In the right sidebar, click **Development**.\n\n   ![Screenshot of the issue sidebar. \"Development\" is outlined in dark orange.](/assets/images/help/issues/development-menu.png)\n5. Click the repository containing the pull request or branch you want to link to the issue.\n6. Click the pull request or branch you want to link to the issue.\n7. Click **Apply**.\n\n## Further reading\n\n* [Autolinked references and URLs](/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls#issues-and-pull-requests)"}