46

Is it possible to create a commit message with link to other repository commit?

Eg. something like [Username\Repo\commitHash]

Usage example: if some bc break would happen in some framework's commit, I'd like to link to this very commit in my own commits updating my code which uses this framework.

Mikulas Dite
  • 7,790
  • 9
  • 59
  • 99

2 Answers2

61

I was searching for something like this myself. Found it on:

https://help.github.com/articles/autolinked-references-and-urls/#commit-shas

<<username>>/<<repo>>@<<commitHash>>

Without the angle brackets of course :)

user2943160
  • 507
  • 5
  • 12
antitoxic
  • 3,746
  • 1
  • 37
  • 46
  • Thanks. I've tried it, but it seems like the hash always points to `current-repo/commits/the-hash` path, no matter what is in front of it. But at least we can use the commit hash to link to current repository. – Mikulas Dite Feb 03 '11 at 16:21
  • 3
    Are you certain this is the case? I just did write antitoxic/diem@2b4514646177a95951202c4aea388cf472b53ca1 in github issues and it is displayed as link correctly. – antitoxic Apr 05 '11 at 16:20
  • 9
    Yup, and if you're within the project you can just do `@COMMIT_HASH`. – Aidan Feldman Aug 05 '11 at 01:03
  • 6
    You don't even need the `@`. `COMMIT_HASH` is sufficient. – erbridge Jan 15 '14 at 18:31
  • 5
    key thing to remember: @ for commit hash, # for issue – prusswan Feb 27 '14 at 09:10
0

I don't think there's anything stopping you from putting something like:

http://github.com/pkrumins/lulzbot/commit/4c1b1ea95b379805e3b595b511a89affc6811145

Right in your commit message. While this doesn't link directly to the git object's version of the commit... it leads to a page showing that commit.

Format is github.com/User/Repo/commit/hashtag

sleepynate
  • 7,926
  • 3
  • 27
  • 38
  • 6
    Thanks, but I don't think this is the right way to do this (even if it is the only way). As with the `close #issue_number` tag, I'd expect something similar. – Mikulas Dite Oct 01 '10 at 16:38