sindresorhus/refined-github

"View file on fork" link in file view #2810

jack1142 posted onGitHub

E.g. file view page, like: https://github.com/sindresorhus/refined-github/blob/master/source/options.html would have a "View file on fork" link (button) which would redirect you to the file on your fork, i.e. for me it would be (assuming I would have a fork of this repo): https://github.com/jack1142/refined-github/blob/master/source/options.html If user doesn't have the fork yet, either the button should not be available or it should also create the fork for the user.


Food for thought.

I was thinking about this. We dont know what branch to open the file on. I think the best way to do this is by copying how comments-time-machine-links works and ask the user if they would like to open the file they were just using.

posted by yakov116 almost 5 years ago

We dont know what branch to open the file on.

HEAD

I think we should just alter the existing link if isSingleFile or isRepoTree.

For example, on this page:

// https://github.com/yakov116/refined-github/tree/123/media

The "forked from sindresorhus/refined-github" link:

<img width="299" alt="" src="https://user-images.githubusercontent.com/1402241/84269289-4fdb4380-ab29-11ea-9b5f-e432b9aaddf1.png">

Should point to:

// https://github.com/sindresorhus/refined-github/tree/HEAD/media
posted by fregante almost 5 years ago

Brilliant and simple idea

posted by yakov116 almost 5 years ago

The same concept can be applied to forked-to, in the other direction, which is actually what this issue is about.

posted by fregante almost 5 years ago

Fund this Issue

$0.00
Funded

Pull requests