Hit y before copying url from github

Let’s say that I’m writing a blog and I need to link to a newly added file. I can link to that file by going to github and copying the url. However a few months later that file might have moved to a different directory and now the link is broken.

Github team created a shortcut to solve this problem. Just hit y on your keyboard before copying the url.

Here is an example.

Let’s say that I am linking to newly created rake_proxy.rb file in Rails 5. If I go to the file in master and copy the url then url looks like as shown below.


As you can see the url is pointing file in master branch. As stated above the problem is that this link is pointing to live master branch and if a few months later this file is moved to some other place then link will be broken.

Now let’s see what happens when I hit y on my keyboard. The url will change to as shown below.


This url is pointing to a blob and not to master branch. This URL will always work.