Skip to content

GithubCommitMessages

Jeff Squyres edited this page Jul 22, 2015 · 3 revisions

Making Git commit messages affect Github issues

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:

  1. Attach the commit message to one or more Github issue(s)
  2. 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.

Attach the commit message

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.

Attach the commit message and close the ticket

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.

Clone this wiki locally