如何设置GitHub默认选择公司仓库作为Pull Request目标仓库?
Great question! I've run into this exact annoyance with forked repos too—here are a few solid workarounds since GitHub doesn't have a built-in setting for default PR target repos:
Use the branch page's "Compare & pull request" button directly
Skip the generic PR flow entirely. Navigate to your company's fork on GitHub, find the feature branch you've pushed changes to, and click the prominent "Compare & pull request" button at the top of the branch page. This will automatically pre-select your company's repo as the target (with its default branch likemainas the base) so you don't have to hunt through the repo list.Leverage GitHub CLI (gh) for one-click PRs
If you prefer command-line workflows, install the GitHub CLI tool. Once set up, you can create a PR targeted directly at your company's repo with a single command:gh pr create --repo <your-company-account/repo-name> --base main --head your-feature-branchThe CLI will remember your repo preference for subsequent PRs from the same branch, so you won't have to specify the repo every time.
Create a custom browser bookmark for PRs
Make a bookmark with this URL structure (replace placeholders with your actual repo details):https://github.com/<your-company-account>/<repo-name>/pull/new/<your-feature-branch>Every time you need to open a PR, click the bookmark—you'll land directly on the PR creation page with your company's repo already set as the target. Just fill in the title and description, and you're good to go.
These methods all cut out the tedious step of manually selecting your company's repo every time. I use the first method most often since it's the fastest without any extra tools!
内容的提问来源于stack exchange,提问作者atiq1589

