Change default base repository for pull requests on forks #11729
Replies: 170 comments 141 replies
-
More discussion at https://github.community/t/changing-the-default-pr-target-when-creating-a-pr-from-a-fork/2842/2 |
Beta Was this translation helpful? Give feedback.
-
GitHub has a default branch setting. The page says:
Unless I am missing something, that setting is not respected for PRs on a fork, given that the default branch of the upstream repo seems to be taken as the base branch for the PR. How about adding a
When creating a PR, these settings could be used to give the current behavior. Then users could change the settings to fit their needs. I'd be happy to learn about any implications I might be missing 😁 |
Beta Was this translation helpful? Give feedback.
-
Has anyone got an update on how to change the base repo? |
Beta Was this translation helpful? Give feedback.
-
To change this behaviour you'd have to change the Compare page URL by external add-ons.
I'm talking a green pull request button. |
Beta Was this translation helpful? Give feedback.
-
The current developer experience is really hard to work with -- I've incorrectly opened (and then closed) PRs to upstream several times at this point and I'm going to have to just remove my upstream association which is a real shame. Would love a solution to this for future projects! |
Beta Was this translation helpful? Give feedback.
-
Same problem here! Just today I closed a PR just clicks before merging it to master on the wrong repository. |
Beta Was this translation helpful? Give feedback.
-
I can attest - this is very annoying. |
Beta Was this translation helpful? Give feedback.
-
same experience here. My solution was finally to create fork form the fork: |
Beta Was this translation helpful? Give feedback.
-
The output of |
Beta Was this translation helpful? Give feedback.
-
Why is this not a setting? One of the main use cases for Forking a repository is to take over a project that is out of maintenance - where the previous owner is ignoring all PRs. Please @github-staff consider just making it a setting so we don't have to click 3 times on every PR to avoid accidentally PR'ing the fork. Thanks. |
Beta Was this translation helpful? Give feedback.
-
This behavior is so frustrating. As a workaround, to detach a repository you can request a ticket here: https://support.github.com/contact?tags=rr-forks&subject=Detach%20Fork&flow=detach_fork |
Beta Was this translation helpful? Give feedback.
-
Please provide this setting. |
Beta Was this translation helpful? Give feedback.
-
Same situation here, we want to work mainly in our fork and contribute some PRs upstream, so we don't want to detach. We had some accidental PRs already, and it's embarrassing. Please let us configure the default |
Beta Was this translation helpful? Give feedback.
-
I maintain a website template that people fork to use. The fact that the github UI for pull requests defaults to the upstream repo instead of the base repo has caused so many people (including me!) to open accidental PRs (against the template itself instead of their own main branch) that I had to create a label specifically for it (22 and counting): |
Beta Was this translation helpful? Give feedback.
-
This starts to suck. The thread is over a year old and as far as I could see has gotten no reaction from GitHub. There are two aspects to this that make this very annoying: first, it's bothering lots of people and second, as I pointed out in my earlier post, this should be relatively easy to fix. One option to potentially get some traction with this, is for someone with an appropriate account type (Pro, Enterprise etc.) to open a support ticket and point this out. I've had success doing that with Atlassian but I only have a free GitHub account myself. |
Beta Was this translation helpful? Give feedback.
-
For the people who have accidentally opened a PR against an upstream repo, I'm curious what exact workflow you're using to open a PR. GitHub web interface? Currently working on a browser extension that would prevent accidental PRs, but it will only help if you're using the web interface to open PRs. Are there other workflows/interfaces that people are using to open PRs where they run into this issue? |
Beta Was this translation helpful? Give feedback.
-
I believe the lack of this feature is breaking GitHub Workflows. Because workflows can only be run from the default branch, they will never run in a forked repo. If this isn't going to be directly fixed, it would at least be nice to see a warning when one attempts to run a Workflow that cannot run for this reason. |
Beta Was this translation helpful? Give feedback.
-
Former GitHub engineer and open source maintainer of a long-running fork of mastodon here. I mostly make pull requests against my own fork and occasionally send patches upstream. I echo that the web interface really needs a default base repo setting for pull requests; I've made several embarrassing accidental PRs against the upstream repo, including one just yesterday. |
Beta Was this translation helpful? Give feedback.
-
I asked github's copilot about this, and
I tried, and it doesn't seem to work. |
Beta Was this translation helpful? Give feedback.
-
Hey @github is there any update on this? Really could do with this! |
Beta Was this translation helpful? Give feedback.
-
Adding my +1 to this. This feature would be extremely valuable. |
Beta Was this translation helpful? Give feedback.
-
+1 to this Wait we didn't had this @github ? rofl |
Beta Was this translation helpful? Give feedback.
-
Yes.
Im working on a fork that probably will never be merged again to the
original.
Everytime I have to create a PR the base branch is the original repo and
not the current repository and end up taking extra clicks which can be
easily forgotten to be made.
If a default is defined we could as well be let to choose which it will be
for the fork.
…On Sun, Jan 19, 2025, 13:05 Rusty Collier ***@***.***> wrote:
Are there any specific limitations in the current system that make it
difficult for your workflow when dealing with forks and PR targets?
—
Reply to this email directly, view it on GitHub
<#11729 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGNEMFZPXH7YN5Z6OXIQ4Q32LPEMHAVCNFSM5OY2FIJKU5DIOJSWCZC7NNSXTOSENFZWG5LTONUW63SDN5WW2ZLOOQ5TCMJYHAZDIMBQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
+1, same here. Please add this feature |
Beta Was this translation helpful? Give feedback.
-
Yep, same here. Not to mention that if you accidentally tap the "compare across forks" button it will only present Tapping that button should activate the compare across forks feature which should be off by default. Even if for some reason GitHub insist on opening the PR by default back to the original repo, tapping that button then should compare branches on your local repository, not just hide the fact that you are comparing branches across different repositories. Giving the fact that it has been almost 3 years since the original post, I doubt they will ever change it, which is really annoying. |
Beta Was this translation helpful? Give feedback.
-
I should have just used my original repo, now I'm forked 😭 |
Beta Was this translation helpful? Give feedback.
-
Chrome extension: Safe Pull Request The extension is now ready and available in the Chrome Web Store: https://chromewebstore.google.com/detail/safe-pull-request/lgjhdicdaddeoodpifjdipgooggbojfc Note that it does require purchasing a license key to function, which you can get here: https://safepullrequest.com/ I think and hope it is good value for the price, but if you have feedback on the price or on anything else about the extension for that matter, feel free to open an issue here: https://github.com/weineran/safepullrequest-feedback/issues Or you can DM me or tag me on X: @ThreeMoonsAreUp Quick Instructions
There is a known issue with the extension where if you open a PR from the repo's /branches page, it still opens the PR against the upstream parent. This is a bug. See here: weineran/safepullrequest-feedback#4 So if you usually open PRs from the /branches page (I think this is uncommon), you might want to hold off on purchasing a license until I fix that. |
Beta Was this translation helpful? Give feedback.
-
I'm piling on with a +1 for this feature. I don't want to use an extension, or try to convince all of the team to open PRs through an IDE. |
Beta Was this translation helpful? Give feedback.
-
:+1 - and I don't want a browser extension for this, because I (and I'm not the only one) don't use chrome / firefox / edge. This is something that needs to be sorted by github not by extension authors. I mean, it lets you create issues against the forked repository and run workflows against the forked repository but you have to go through hoops to make PRs to fix the issues that have been raised... |
Beta Was this translation helpful? Give feedback.
-
The lack of any sort of a response from @github here is baffling. This is clearly a common pain point and, seriously, how long could this possibly take for them to implement? One of the orgs I work with has either a higher tier paid account and I'll see if they're willing to open a ticket about this problem. My use case, for whatever it's worth: we forked a repo which was making fundamental but experimental changes to the origin repo's application structure and contents. It may be upstreamed one day or both repositories may live on indefinitely. Until we have a better sense of which way things will play out, why should we have to constantly dance around the issue of selecting the target repository when opening a pull request? In our case, I'm not aware of anyone accidentally opening a PR to the wrong repo but the UX of switching the repository in the web UI, waiting for the page to refresh, etc. is worse than it has any reason to be. |
Beta Was this translation helpful? Give feedback.
-
I've forked a repository which has been archived by the owner, so there won't be any prs accepted to the original repository.
Therefore I'd like to change the base repository for all PRs made from to my repository but this seems not possible.
Is there a recommended way to deal with this situation other than (re)creating the repository without forking?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions