Hello everyone,
in the wake of a
potential project folder restructure operation, it occurred to me that we're doing a poor job with future-proof GitHub links.
Whenever we link source code, we actually mean to link the current version, right? However, a file might change (invalidating line numbers), be renamed or moved (invalidating the link itself) and thus the link we posted will no longer work in a few months / years when someone comes searching.
Good thing is, GitHub has actually a nice hidden feature that will rescue us if we stick to using it from now on.
Whenever opening a file on GitHub in order to copy the URL to link it, press Y first. GitHub will redirect your page to the
specific permalink of the version you're currently looking at. Using this link, it won't matter at all what happens to the file in the future. It will always remain as-is.
Example:This link will break.
This link should work fine even after the source code changed.
So in the future, whenever you link to a file, please add that additional key press to your routine. It's nothing much, but it will help a lot in the long run.