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.

In this article

Did this doc help you?

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.

Note: The special keywords in a pull request description are interpreted when the pull request targets the repository's default branch. However, if the PR's base is any other branch, then these keywords are ignored, no links are created and merging the PR has no effect on the issues. If you want to link a pull request to an issue using a keyword, the PR must be on the default branch.

About linked issues and pull requests

You can link an issue to a pull request 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. If the pull request and the issue are in different repositories, GitHub Enterprise will display the link after the pull request is merged, if the person who merges the pull request also has permission to close 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 "Changing the default branch."

Linking a pull request to an issue using a keyword

You can link a pull request to an issue by using a supported keyword in the pull request's description or in a commit message (please note that the pull request must be on the default branch).

  • close
  • closes
  • closed
  • fix
  • fixes
  • fixed
  • resolve
  • resolves
  • resolved

The syntax for closing keywords depends on whether the issue is in the same repository as the pull request.

Linked issueSyntaxExample
Issue in the same repositoryKEYWORD #ISSUE-NUMBERCloses #10
Issue in a different repositoryKEYWORD OWNER/REPOSITORY#ISSUE-NUMBERFixes octo-org/octo-repo#100
Multiple issuesUse full syntax for each issueResolves #10, resolves #123, resolves octo-org/octo-repo#100

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.

Further reading

Did this doc help you?

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Or, learn how to contribute.