47

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.

2
  • You accepted the wrong answer bud... Commented Sep 10, 2012 at 12:47
  • 3
    @RobinWinslow I'm pretty sure it was accurate back then. Anyway, you are right it would be appropriate to update it. Done. Commented Sep 10, 2012 at 15:36

2 Answers 2

63

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 :)

Sign up to request clarification or add additional context in comments.

5 Comments

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.
Are you certain this is the case? I just did write antitoxic/diem@2b4514646177a95951202c4aea388cf472b53ca1 in github issues and it is displayed as link correctly.
Yup, and if you're within the project you can just do @COMMIT_HASH.
You don't even need the @. COMMIT_HASH is sufficient.
key thing to remember: @ for commit hash, # for issue
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

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.