Closing multiple issues in Github with a commit message
I know you can close issues by putting closes #1
or fixes #1
in the commit message. What is the best way to close multiple issues in the same commit message?
Also, it appears that using fixes
rather than closes
doesn't create a link from the commit message to the issue, but it does close the issue. What's up with that?
Solution 1:
Closes #1, closes #2, closes #3; rest of commit message.
The closes
clauses can be anywhere in the message and fixes
is a valid synonym:
This fixes a memory leak in foo() that closes #4,
also fixes #5 which is a duplicate.
The following used to work, but nowadays only references issues #2 and #3.
Closes #1, #2, #3
Solution 2:
The answer and a comment to that answer mention the following format:
Closes #1, closes #2, closes #3; Actual commit message
If I had a project worth participating in and someone sent a pull request with such commit messages, I would refuse the pull no matter how beautiful the code was.
It is possible this is just a matter of my personal preference and will end up beaten to the very ground by people used to compact commit messages that clutter up Git history summaries, but I would much rather see commit messages with the format:
Summary of the change made.
Fixed following bugs:
* Modified error loader, fixes #1
* Returned a nonstale pointer, fixes #2
* Applied new graphics to gui elements, closes #3
He asked for the best way to close multiple issues.
Also note that if you push the commit with the message to any other branch than the current default branch of your repository, the issues will only be referenced. Pushing the commit to the main branch will close the issues. See: Link to GitHub issue number not working?