Posted about 6 years ago. Visible to the public. Repeats. Linked content.

Getting permanent links to files on Github or Gitlab

Please don't simply copy line number links from Github. The URL usually contains a branch name like master which will change over time:

Copy
https://github.com/makandra/upjs/blob/master/lib/assets/javascripts/up/link.js.coffee#L76

If someone now posts an insertion or deletion to that file into master your link points to the wrong line!

A better way is to press the Y key after clicking on a line number. This will transform the URL to another URL that points to the particular commit:

Copy
https://github.com/makandra/upjs/blob/b3b1491dfa1e3e83265ef228631382868909c617/lib/assets/javascripts/up/link.js.coffee#L76

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Avatar
Henning Koch
Last edit:
3 days ago
by Henning Koch
Keywords:
absolute, sha1, hash
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more