Last Updated: April 07, 2017
· mislav

Your GitHub URLs should be timeless

Most folks publish GitHub URLs to view some code like so:


Even if it doesn't highlight any line numbers in particular, it's still a bad idea to have "master" as revision in the URL. In the future, the version of this file in the master branch will probably be different, or even non-existing (file got renamed/removed).

Whenever you link to some code, ensure the revision is a particular tag or SHA, because those won't change. Here's the proper link for the above example:

To get that in the browser on GitHub.com, press <kbd>y</kbd> to expand the URL to its permalink form. (Thanks, Andy!)

From Vim and Fugitive.vim, it's easy to copy the URL for the current file/visual selection to the clipboard:

:Gbrowse! -

Bonus advice: whenever you link to projects on GitHub, append #readme to the URL. Most visitors are interested primarily in the Readme and this will save them from always having to scroll down past the file listing:


Say Thanks

1 Response
Add your response


Never heard of this shortcut. Thanks!

over 1 year ago ·
Filed Under