How to refer to a previous commit in git commit message
GitGithubGit Problem Overview
Is there a convention for referring to a previous commit in a git commit message?
Example commit message:
Fixed bug such and such introduced in a1b2c3e4
In particular, is there a convention that github.com will understand, and convert to a link?
Git Solutions
Solution 1 - Git
Yup - GitHub will pick up references to SHAs and users/repos patterns using the GitHub Flavored Markdown
Specifically about linking to commits:
> A bit of the GitHub spice > > In addition to the changes in the previous section, certain references are auto-linked: > > * SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 > * User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 > * User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2 > * #Num: #1 > * User/#Num: mojombo#1 > * User/Project#Num: mojombo/god#1
Solution 2 - Git
Guys at git answers the question this way:
> If you want to reference a previous commit in the history of a stable branch, use the format "abbreviated hash (subject, date)", like this:
>
> Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30)
> noticed that ...
>
>The "Copy commit summary" command of gitk can be used to obtain this format (with the subject enclosed in a pair of double-quotes), or this invocation of git show:
>
> git show -s --pretty=reference