How can I reference a commit in an issue comment on GitHub?

239,997

Solution 1

To reference a commit, simply write its SHA-hash, and it'll automatically get turned into a link.

See also:

Solution 2

Answer above is missing an example which might not be obvious (it wasn't to me).

Url could be broken down into parts

https://github.com/liufa/Tuplinator/commit/f36e3c5b3aba23a6c9cf7c01e7485028a23c3811
                  \_____/\________/       \_______________________________________/
                   |        |                              |
            Account name    |                      Hash of revision
                        Project name              

Hash can be found here (you can click it and will get the url from browser).

enter image description here

Hope this saves you some time.

Solution 3

Just paste the commit referencing link in the comment github automatically mentions the commit on the comment.

Solution 4

If you are trying to reference a commit in another repo than the issue is in, you can prefix the commit short hash with reponame@.

Suppose your commit is in the repo named dev, and the GitLab issue is in the repo named test. You can leave a comment on the issue and reference the commit by dev@e9c11f0a (where e9c11f0a is the first 8 letters of the sha hash of the commit you want to link to) if that makes sense.

Share:
239,997
LodeRunner
Author by

LodeRunner

Updated on July 08, 2022

Comments

  • LodeRunner
    LodeRunner almost 2 years

    I find a lot of answers on how to reference a GitHub issue in a git comment (using the #xxx notation). I'd like to reference a commit in my comment, generating a link to the commit details page?