How do you close issues automatically using pull requests?
How do you close issues automatically using pull requests?
496
08-Jul-2025
ICSM Computer
20-Jul-2025You can automatically close GitHub issues using pull requests by referencing the issue number with specific keywords in your pull request description or commit message. When the pull request is merged into the default branch (usually
mainormaster), GitHub will automatically close the referenced issue.Syntax for Automatically Closing Issues
In your pull request description (or the merge commit message), use one of the following keywords followed by
#issue-number:Closes #123Fixes #123Resolves #123Example:
This will automatically close issue #42 once the PR is merged.
Supported Keywords (case-insensitive)
Multiple Issues
You can reference multiple issues like this:
Or one per line:
Important Notes
Tip: Preview What Will Happen
GitHub will display a linked issue preview in the PR under the “Linked issues” section. If it says “will be closed when this pull request is merged,” it's set up correctly.