sindresorhus/refined-github

Option to choose repository where to edit the current file #2815

jack1142 posted onGitHub

Currently if I'm editing something on my fork through the edit view and I'll choose to create a new branch and start a pull request, GitHub will redirect me to "Open a pull request" page on the fork I used, not at the repository I forked. While this makes sense, I think it would be great if I were also able to choose different base repository.

Example URL: https://github.com/jack1142/refined-github/new/master Where jack1142/refined-github is someone's fork you have write access to.

Draft of what I mean (by no means should it be styled like this, but I'm not a web designer :P) image


When I was doing some checking, it looks like this would be possible to solve by editing value of hidden input field with name="quick_pull" that is placed in the form I sent a screenshot of above. For example, if the value of it is master, changing it to sindresorhus:master is gonna make it redirect me to "Open a pull request" page for sindresorhus/refined-github repository instead.


The non-dropdown solution you suggested before would probably be faster and easier than this. Most people don’t have many active forks; this would only show existing forks (probably it can reuse the data cached by forked-to)

posted by fregante about 5 years ago

The non-dropdown solution you suggested before would probably be faster and easier than this

Actually perhaps the dropdown is best, as in your first screenshot

posted by fregante about 5 years ago

Looked into this. It would need an api call since there is no "preload" url we can use (like we do for the tags). Is it worth the api call? Also it would only bring the first 100 unless we paginate.

posted by yakov116 over 4 years ago

Maybe this could be cached similarly how showing the link to fork (near the fork button at the top of repository) is cached?

posted by jack1142 over 4 years ago

But there can be 1000 forks

posted by yakov116 over 4 years ago

But there can be 1000 forks

But you don't use or have write permissions to each. That's why I said that it's somewhat similar to the link to fork near the fork button in repository header.

posted by jack1142 over 4 years ago

Ahh only ones with write permissions

posted by yakov116 over 4 years ago

I think this feature isn't necessary anymore thanks to improvements in forked-to: https://github.com/sindresorhus/refined-github/pull/3216

  1. View file
  2. Pick the right repository
  3. Then edit the file
posted by fregante over 4 years ago

It would be still somewhat useful (imo) if it remembered last choice (similarly to what merge button does for example), but I still am not sure if there's even feasible way to implement this (I see that I said in the issue description that seems to be one, but I am don't know how correct that description is, as that's not how I remembered this).

posted by jack1142 over 4 years ago

The point is: why do this at all? Just change fork before trying to edit the file.

posted by fregante over 4 years ago

looks again at issue title and then at description

Huh, it seems that the issue title is misleading. The problem described in issue description is that when you edit file on fork and click the "Propose new file", it will make you go to the "Open a pull request" page on the fork, not on the source repository: image

So from there, you need to at least first click on the link to source repo, and then for example click the "Compare & pull request" that should show up in the top right corner which seems like 2 unnecessary page switching that could be solved if the thing in screenshot in issue description (or something similar) got added.


As for the feature that issue title is talking about, what you said here is probably enough:

I think this feature isn't necessary anymore thanks to improvements in forked-to: #3216

  1. View file
  2. Pick the right repository
  3. Then edit the file

There are 2 issues that I see with the forked-to feature though:

  1. The button will take you to home page if you're already on edit the file page
  2. Clicking the button takes me to HEAD/file_path... on fork, so I can't actually edit the file just yet and I need to first switch branch (this might again be the case of branches with slashes, I'm not sure about that)

That probably is worth a separate issue though.

posted by jack1142 over 4 years ago

when you edit file on fork

We're back to square one. Why are you editing files on forks if you're going to submit to the original repository? Just edit them on the original repository and GitHub will take you through the correct path of forking, if necessary, and proposing the file on the original repo

There are 2 issues that I see with the forked-to feature though:

Those are valid points, a new issue can be opened for those

posted by fregante over 4 years ago

Just edit them on the original repository and GitHub will take you through the correct path of forking, if necessary, and proposing the file on the original repo

But that's not what I want - I always want to use fork, even if I have the write perm to the original repository. Our workflow is based on forks and we generally avoid creating branches on original repo. I know this project is opinionated, but it seemed valid to ask for a feature that allows to (but doesn't force you to) choose to which repo you want to make PR, regardless of what repo you're making the branch on.

Those are valid points, a new issue can be opened for those

I'll make issue(s) for those in a moment then.

posted by jack1142 over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests