This is my memo about GitHub issues. In this article I will focus on the close key word which allows you to close the linked issue automatically when your pull request is merged with the default branch. I would be happy if you could provide your own usage rules, since I am interested in real life usage.
These 9 words are close keywords which you can link to issues when you open a pull request.
close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved
The issue will be closed when your branch is merged into the default branch. In other words, when your pull request is not on the default branch, your pull request is linked to the issue, but the issue won’t be closed automatically after your pull request is closed.
Pattern1: Issue in the same repository
I added something to fix #1
Pattern2: Issue in a different repository
Pattern3: Multiple issues
list all linked issues with syntax above
resolved #10, resolved #11, fixed resolve Lada496/github-practice#12
There are two options: 1) the comment on your pull request and 2) your commit message.
The differences between PR comment and commit message
The linked issue is automatically closed but the pull request that contains the commit will not be listed as a linked pull request when you use the commit message. On the other hand, the linked issue is automatically closed and the pull request will be listed as a linked pull request when you use PR comment. I will show you what exactly this means in the experiment part.
Linking a pull request to an issue - GitHub Docs
There are two questions that I wanted to determine: 1) What happens if you merge a branch into the default branch after the branch is merged with another branch linked to an issue? and 2) What exactly differences between PR comments and commit messages.
Experiment1: On which should the issue linked pull request be?
condition: the default branch is main
1) your pull request is on the develop branch -> No
2) your pull request is on the main branch -> Yes
3) your pull request is develop and the develop branch is merged to main -> Yes??
1 and 2) are obviously true, but I went through all the patterns during the process and determined whether 3) is true or not.
Experiment2: Where to put closing key words
I visited an open source project (React bootstrap) to see how they use issues. I was especially interested in which is better to put close key words. As a result, they use both.
These are typical examples.
Missing export for ModalHeader · Issue #6226 · react-bootstrap/react-bootstrap
Tabs component has no Fade transition by default · Issue #6232 · react-bootstrap/react-bootstrap
When a tooltip is visible and you start scrolling, the tooltip appears above other elements. ·…
However, the sample size is too small to conclude that this is the best practice. Therefore please tell me if you have any opinion about it.
Thank you for reading :)
The original article is here