This article was originally published by Yanglbme on the public account “Doocs Open Source Community”. Unauthorized republication is prohibited.
For those of you who have been on GitHub, GitHub automatically shorties and transforms references to URLs, Issues, Pull requests, and Commits into hyperlinks. Let’s take a look.
URLs
GitHub automatically creates links to standard urls. For example, if we write the URL https://github.com/doocs in the discussion area of Issues and click preview, we can see that GitHub will automatically add a link to this URL. Click to jump to the corresponding URL page.
Issues and Pull requests
On GitHub sessions (such as the comments for Issues and Pull Requests), our references to Issues or Pull requests are automatically converted to shortened links on GitHub.
Reference types | The original reference | Shortened links |
---|---|---|
Issue/PR URL | Github.com/doocs/leetc… | # 167 |
# number |
# 226 | # 226 |
GH- number |
GH-225 | # 225 |
user/repo#number | yyx990803/buble#9 | # 9 |
org/repo#number | doocs/leetcode#167 | # 167 |
Take the first reference type above. We write this URL https://github.com/doocs/leetcode/issues/167 on Issues comment area, then making will be close to help us to shorten as # 167, and automatically add the link, you can refer to below demo:
Note that the numbers in the table refer to the numbers on the GitHub issues or branch. Additionally, GitHub does not automatically create link references to files in the GitHub Wiki or repository.
Commit SHAs
GitHub also automatically converts references to SHA hashes of Commits to shortened links.
Reference types | The original reference | Shortened links |
---|---|---|
Commit URL | Github.com/doocs/leetc… | db46f93 |
SHA | db46f93f8a820da6f64a9a6707a3d4b9a6c13f34 | db46f93 |
user@SHA | yanglbme@2fce918a54da2a9e89dd10c8e2fa222929704d03 | 2fce918 |
user/repo@SHA | yyx990803/buble@f5996c9cdb2e61cb7dddf0f6c6f25d0f3f600055 | f5996c9 |
Take the fourth reference type above. Our personal project buble Pull in especially big requests the regional input yyx990803 / buble @ f5996c9cdb2e61cb7dddf0f6c6f25d0f3f600055, click preview, You can see that GitHub has automatically converted the reference we entered to F5996C9 and added the hyperlink.
GitHub is so sweet. Thank you GitHub.
Welcome to follow my public account “Doocs Open Source Community”, the first time to push original technical articles.