Thanks for this great extension. Could you add a feature so that when I click on a link from search result it takes to the master branch? I understand the file may be missing from master branch. May be there could be an extra link that opens a new tab which open the link in master. If that fails (404), I can open whatever git hash github search result in showing.
Can you give me an example where the search result doesn't take you to the master branch?
Say, you go to https://github.com/sindresorhus/refined-github/search?q=branch&unscoped_q=branch . Click on any link.
It takes you to a page link below:
Instead I like to go to https://github.com/sindresorhus/refined-github/blob/master/source/features/add-branch-buttons.js page.
That's kinda weird. The search takes you to the last commit that touched that file.
Also, deleted/moved files don't appear in searches, so it could never 404.
The hard part is that we don't know what the default branch is without first visiting a non-default branch page… or via API call.
How about just adding an extra button that I can click to go to the master page. It does not have to always work (assuming it is missing in master branch etc).

master != default branch
I'd rather not add buttons that don't work because we'll get issues like #1413
I don't have a clear idea. I can tell you why linking to to the last commit for a search result does not work for me.
I mostly code in GO and I use Sourcegraph's chrome plugin to go to definition type thing from browser. Sourcegraph uses current branch of a file to go to definition. So, I almost always have to go to master so that I get the correct definition for a type.
I don't have a clear idea. I can tell you why linking to to the last commit for a search result does not work for me.
I'm not saying it won't work; I'm saying that we have to know the default branch before doing what you're asking, and the default branch isn't always master.
I mostly code in GO and I use Sourcegraph's chrome plugin to go to definition type thing from browser. Sourcegraph uses current branch of a file to go to definition. So, I almost always have to go to master so that I get the correct definition for a type.
That's unrelated. The change you're asking for will not affect Sourcegraph links because they are direct to the file, they don't go through the search (by judging the video here https://about.sourcegraph.com/)
I do the searching from Github UI and then go the result page that github shows. Then use Sourcegraph to visit function definitions etc.
I don't use Sourcegraph search directly because they are too slow to be usable.
We now show a "master" button if you visit a file on a specific SHA. Example: https://github.com/sindresorhus/refined-github/blob/b99ffe66ad40a37140da05ca01f96dbe5c207e4e/package.json
Most helpful comment
Say, you go to https://github.com/sindresorhus/refined-github/search?q=branch&unscoped_q=branch . Click on any link.
It takes you to a page link below:
https://github.com/sindresorhus/refined-github/blob/75dcbf0f28632b241397120ba54bcfb5f383683f/source/features/add-branch-buttons.js
Instead I like to go to https://github.com/sindresorhus/refined-github/blob/master/source/features/add-branch-buttons.js page.