But (only) rarely do people follow these three (extra) steps.
You can blame people (posters) for not following these extra steps, but (as a matter of human nature, IMHO) we can't expect most people actually to follow them, because currently (as they observe it) their gathered links are correct. They merely become obsolete over time.
In practice, this screws up blog and StackOverflow posts, etc. which contain links to specific locations inside source code (on GitHub). For most of these links, their reasonable use is to point to source code (sometimes source lines) visible in the latest commit. Yet these posters (almost always) gather links which actually point to an evolving branch (usually 'master'). As source code evolves, these links quickly become obsolete.
This obsolescence is especially bad with line-specific links, but also happens for file-specific ones.
Here let me say that GitHub's wonderfully good UI is GitHub's greatest and best feature! :)
But the clumsiness of this detail of GitHub's UI (here) is at fault IMHO for this problem. :(
I tried to enlist StackExchange's help to argue this case with GitHub, but to no avail. Also, I asked GitHub directly. We shall see.
This screwup (of obsolete links in people's posts) is apparent, bothersome, and quite frequent!
As a solution, GitHub should consider implementing the following UI improvement:
Make generating such permanent, line-specific links (in browsers' address bars) much easier for their users by adding a button (to all source-display web pages on branches). This button (with a single click) would:
- Switch from viewing the source code (including a line reference) on a branch, to viewing that source code (including the same line reference) in a blob. To be helpful, that blob must be the latest commit of that branch.
GitHub already distinguishes branch heads from blobs. This is apparent in GitHub's sometime use of the word 'blob' as an URL path segment name (versus the words 'commits/master').
Therefore, GitHub seems easily able to find the latest commit SHA1 for a given branch and do what is desired here: that is, redirect the browser to the corresponding line in the latest commit.
UPDATE: Just four(!) hours later, this nice reply came back from a GitHub staffperson:
"Great idea, thanks! There is a shortcut key "y" that you can hit on any code page to change the URL to the permanent link. But you're right that people may not always choose to do that.
"I've added your idea to our internal Feature Request List. We can't say if/when we may add a feature, however your feedback has definitely been recorded."
Although GitHub's pages don't present this feature in an obvious way, GitHub's Help here further describes their 'Y' shortcut key's hidden access (to it) that she's talking about.
UPDATE: StackExchange support replied with:
I'm not entirely certain what you were trying to accomplish with that post. First, it was on meta.stackoverflow.com, where users go to talk about Stack Overflow itself. We discuss features, community governance, file bugs and similar activities on meta.
However, your post would not have been on topic for Stack Overflow either, it's a complaint about how Github works, as far as I can tell, not a question. We're not a typical forum, we're a Q&A site. To get a better idea of how our engine works, take a brief tour of the features.
Sorry that you had a bad experience, but there's not much we can do about it at this point. If you've got a succinct programming question where the problem can be demonstrated with a short code snippet, you're more than welcome to ask on Stack Overflow. If you have a question about Stack Overflow itself, how it works, or an idea to improve it - then feel free to post on meta.
Regards
Stack Exchange Team
I replied to StackExchange support with:
Hi, Team,
> it was on meta.stackoverflow.com, where users go to talk about Stack Overflow[.]
> about Stack Overflow itself, how it works, or an idea to improve it -
> then feel free to post on meta.
> it's a complaint about how Github works, as far as I can tell, not a question.
Yes, this is about StackExchange.
If you think about it, permanent links, including those to GitHub.com, comprise part of the business value of the StackExchange family of sites.
Your reply doesn't answer my suggestion that it's in the interest of StackExchange, the company, to try to encourage GitHub, the company, to improve their GUI, so that permanent links are easier (and less error-prone) to make.
I'm sure there are ways the staff of StackExchange can convey this interest (of the StackExchange company) to the staff of GitHub.
I cast about for how I can communicate this (I believe helpful) idea to the staff of StackExchange, and the two methods I tried (which you already know about) came to mind. Yes, I have contacted GitHub about this, but I am suggesting that StackExchange do this for itself, as well.
Who else can I contact, besides the StackExchange support team? Do tell!
> Sorry that you had a bad experience
To me, that has little importance. Much more important is the business suggestion for StackExchange, and (as you know) to improve the world, if I can.
From a reply from GitHub, I learned that hitting the 'Y' key switches their webpages to permanent links, easily.
For StackExchange, the problem is that accessing this GitHub switching functionality by hitting 'Y' is not widely known. So, in questions and answers on StackExchange, many people (perhaps) are sharing transient GitHub links.
GitHub may be reluctant to use a half-square inch of real estate on their webpages to make this functionality visible, since that visibility wouldn't help them directly.
But as good neighbors (or something like that) GitHub may be willing to "do the right thing," especially if StackExchange and Wikipedia, et al, ask them to. That's what I think.
Who knows whether GitHub might actually respond? Why doesn't StackExchange try? (i.e., for the purpose of aiding StackExchange's own business interest).
With warm regards,
Mark D. Blackwell
Copyright (c) 2014 Mark D. Blackwell.