Hacker News new | past | comments | ask | show | jobs | submit login

ProTip: Hit the y key on any GitHub page with source code.

It'll instantly expand the URL to its canonical form, e.g.

https://github.com/sass/libsass/blob/master/parser.cpp#L29-L...

to

https://github.com/sass/libsass/blob/fca1f75a14fe5336c7b1a4b...

which stays valid indefinitely (unless the commit is deleted from the repo).

P.S. Hit the ? key for more keyboard awesomeness. :)




Yeah, that's what he said in the post.


Not what he said in the title though. Should be "don't link to non-canonical urls on github", line numbers are irrelevant.


We're meant to read more than the title nowadays?


Like the original comment, my original thought was that it was probably something to do with people referring to line numbers on HEAD. A less link-bait title that confirmed this would have allowed me to easily skip this this article which, for my purposes, was useless.


This seems glaringly obvious.

If you statically link to a specific line number, and if your source code changes, then your static link may not point to the same code... duh?


I actually feel that the post isn't even just about people who don't know that linking to a line number in a changing file will result in incorrect information later. I think it's more that when people link to code, they think it doesn't matter, so it's not something they actively care about. So they don't take the extra time to link to the actual commit since it's not a thing they care about.

I feel the authors real value in their article is a call for people to care about correcting their links for programmers in the future. The article would be better served to say, "Why you should care about linking in time to your GIT repo"


Thanks! It was a pain. Especially if you've moved from Bitbucket where "stable" links to line numbers are default.


Why doesn't the URL look how it would look if you hit y by default? Seems like that would be what you usually want.

When I send someone a link, it's because I want them to see what I'm looking at.


When I paste a link from A (which I control) into B (which I control) , I want to be able to change A and have people who click on the link from B get the new A, not the old A. It's the same reason you ideally want to specify depedencies by branch, not by tag.


Another reason to love github, thanks.


This is huge.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: