GitHub: merging a pull request did not close the issue
You can link a pull request to an issue with a supported keyword in the pull request's description, such as Closes #10, and when you merge a linked pull request into the repository's default branch, its linked issue is closed automatically. The keywords are interpreted only when the pull request targets the default branch: on a pull request into any other branch they are ignored, no links are created, and merging the pull request has no effect on the issues (GitHub's linking a pull request to an issue, checked October 26, 2026).
Closes #10 Fixes octo-org/octo-repo#100 // in the description of a pull request into the default branch
The keywords
- Nine words:
close,closes,closed,fix,fixes,fixed,resolve,resolvesandresolved, followed by a reference to the issue (GitHub's using keywords in issues and pull requests). - The syntax:
KEYWORD #ISSUE-NUMBERfor an issue in the same repository, andKEYWORD OWNER/REPOSITORY#ISSUE-NUMBERfor an issue in a different repository. For several issues, use the full syntax for each one, as inResolves #10, resolves #123, resolves octo-org/octo-repo#100. A keyword can be followed by a colon or written in uppercase:Closes: #10,CLOSES #10. - Where: in the pull request's description, the summary text the author added when they created it, or in a commit message. With a keyword in a commit message, the issue is closed when you merge the commit into the default branch, but the pull request that contains the commit is not listed as a linked pull request.
- Another pull request: if you use a keyword to reference another pull request, the pull requests are linked, and merging the referencing pull request also closes the referenced one.
To know before you merge whether the issues will close: Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, proposes the default branch as the target and says that closing keywords work only into it, and its merge dialog says when a merge will not close the issues named.
Why the issue stayed open
- Another branch: the pull request went into a branch other than the default branch, such as a release branch, so GitHub ignored its keywords. The default branch is the branch GitHub displays when anyone visits the repository and, unless you specify a different branch, the base branch for new pull requests; GitHub names it
mainin any new repository (GitHub's branches). - Linked by hand: GitHub describes the automatic close of a linked issue, however the pull request was linked, as happening when the pull request is merged into the default branch.
- Auto-close turned off: by default, merging a linked pull request closes the issue, but repository administrators and maintainers can turn that off with Auto-close issues with merged linked pull requests in the repository's settings (managing the automatic closing of issues).
What to do
- Check the base branch: compare the branch the pull request merges into with the repository's default branch.
- When the work reaches the default branch: closing keywords in the description of the pull request that brings it there, or in the commit messages it merges into the default branch, close the issues then.
- Link by hand: anyone with write permissions to a repository can link a pull request to an issue from the pull request's sidebar, under Development: up to ten issues per pull request, in the same repository. From the issue's sidebar, the pull request or branch can be in a different repository.
- A branch created from the issue: anyone with write permission can create a branch from the issue's sidebar, under Development; by default it is made in the same repository, from the default branch. A pull request for that branch is linked to the issue automatically, and then shows in Development in place of the branch. GitHub marks this feature as a public preview (GitHub's creating a branch to work on an issue).
- Unlink: only manually linked pull requests can be manually unlinked. To unlink an issue linked with a keyword, edit the pull request's description to remove the keyword.
- See what will close: in the GraphQL API, a pull request's
closingIssuesReferenceslists the issues that may be closed by the pull request;excludeUserLinkedleaves out the manually linked ones (GitHub's GraphQL reference for pull requests). - From the issue's side: in the GraphQL API, an issue's
closedByPullRequestsReferenceslists the open pull requests referenced from the issue.includeClosedPrsadds closed ones,userLinkedOnlyreturns only the manually linked pull requests andexcludeUserLinkedleaves them out; all three are false by default (Issue in the GraphQL reference). - Find the issues left open: in GitHub's search,
repo:OWNER/REPO is:issue is:open linked:prlists the open issues that are linked to a pull request by a closing reference, and one whose linked pull request is already merged did not close. A pull request into another branch creates no link, so its issues are not in this list.-linked:prgives the open issues with no such link, andlinked:issuedoes the same for pull requests (GitHub's search for linked issues and pull requests). - Search by why it closed:
is:closed reason:completedmatches the issues closed as completed, andis:closed reason:"not planned"those closed as not planned (GitHub's search by the reason an issue was closed). - Turn auto-close back on: in the repository's Settings, under General, scroll to the Issues section and select Auto-close issues with merged linked pull requests. An issue whose pull request was merged while it was off can be closed by hand (closing an issue).
- Close it from the command line:
gh issue close 10 --comment "Fixed by #12"closes issue 10 with a comment.--reasontakescompleted,"not planned"orduplicate, and--duplicate-of 456marks it as a duplicate of issue 456 (the GitHub CLI's gh issue close). - See what linked or closed it: the issue's timeline events (
GET /repos/{owner}/{repo}/issues/{issue_number}/timeline) includeconnectedanddisconnected, for a link to a pull request made or removed, andclosed. When aclosedevent has acommit_id, that commit closed the issue with the closing keyword syntax (issue event types, list timeline events for an issue). - Read why it closed: in GraphQL, an issue's
stateReasonisCOMPLETED,DUPLICATE,NOT_PLANNEDorREOPENED(IssueStateReason). AClosedEventin the timeline has its ownstateReasonandduplicateOf, the issue or pull request that the issue was marked as a duplicate of (ClosedEvent).
In IntelliJ IDEA: put the keyword in the description, not in a commit body
Checked in the IntelliJ IDEA source on November 1, 2026: GHPRCreateViewModel.kt, GHPRRepositoryDataServiceImpl.kt, getPullRequestTemplates.graphql, GHPRReviewFlowViewModelImpl.kt, GraphQL files of the GitHub plugin.
In the new pull request form, write it in the description:
Closes #10
The description starts from the repository's pull request template (the first non-empty one GitHub returns), and the IDE sends what is there as the description. With the default branch as the base, the keyword works as it does on GitHub. The base starts at the default branch but can be changed in the form (how the IDE picks the branches).
Squash and Merge… writes its own message: "Merge pull request #123" and a "* " line for each commit headline (the merge dialog). Commit bodies are not in it, so a keyword that was only in a commit body does not reach the default branch with that squash. Put it in the description, or add it in the dialog. Merge… and Rebase keep the original commits with their messages.
The IDE does not read closingIssuesReferences, so it does not show which issues a pull request will close. Check that on GitHub.
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows a pull request's reviews, checks and conversations next to the diff, and merges it with the methods the target branch allows. Its create dialog proposes the repository's default branch as the target and says under the description that closing keywords such as Closes #10 link and close issues only on a pull request into that branch. When the description of a pull request into another branch names issues with closing keywords, the merge dialog says that the merge will not close them. The review inbox, diffs and conversations are free; approving, commenting, merging and creating pull requests are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · "Resource not accessible by personal access token" · 401 "Bad credentials" · "Resource protected by organization SAML enforcement" · "API rate limit exceeded" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub pull request not created (422, 403) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub merge method not allowed (405) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge waiting for a team's approval (Required reviewers) · GitHub merge blocked by secret scanning alerts · GitHub stacked pull request not merging · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語