-
Notifications
You must be signed in to change notification settings - Fork 868
GithubCommitMessages
It is is fun and useful to have Git commit messages directly affect Github issues. From within a Git commit message, you can do one of two things:
- Attach the commit message to one or more Github issue(s)
- Attach the commit message to one or more Github issue(s) and close the issue(s)
Note that neither of these two things will happen until you push your commit(s) to Github.
If you include the a hash sign followed by an integer (e.g., #1
)
anywhere in your Git commit message, Github will add the following to
the Github issue specified by the integer:
[username] references this issue from a commit on [date]
[First line of the commit message] [git commit hash]
[...]
You can both click on the git commit hash to see the full commit, and also click on the [...] to see the rest of the body of the commit message.
You can refer to as many Github issues in the commit message as you'd like; they'll all be linked in a similar manner.
This only works for the master
branch! Github's action shortcuts (closes
, fixes
, etc.) only work on the default branch of the repository, which is master
for the ompi repository. Similar to attaching to the commit message, you can also close a Github issue from a git commit message. For example, if you use the word "Closes" or "Fixes" before the "#" form (e.g., Closes #2
), it will both link your commit message and close the issue.
Note that the closing token is case-insensitive -- you can use Closes
or closes
(or fixes
or Fixes
).
Finally, note that Github supports several "closing" words -- see this Github help page for a full list of all the words you can use in a git commit message to close Github issues.