← Back to Blog

How to Change the Default Base Repository for Your GitHub Fork

2025-12-13by Andrew Weiner

How to Change the Default Base Repository for Your GitHub Fork

If you've ever worked with GitHub forks, you've probably experienced this frustrating scenario: You create a pull request, and realize too late that it's headed to the upstream repository instead of your fork. Sometimes that's desired, but lots of times you actually want to open the PR against your fork. If you're not paying close attention, you end up opening an accidental PR against the wrong repo. This causes leaked code, confusion for maintainers, and workflow friction.

The Problem: GitHub's Default Behavior

When you fork a repository on GitHub, the platform assumes you want to contribute back to the original (upstream) repository. This makes sense for open source contributions, but it's problematic when:

  • The upstream repository is archived - Your pull requests can't be merged and just create noise
  • You're developing on a long-term fork - You want to manage your own development workflow
  • You're working on proprietary code - Accidentally exposing your changes to the public upstream is a security risk
  • The upstream doesn't accept PRs - Some projects don't want external contributions

GitHub doesn't provide a built-in setting to change the default base repository for pull requests from forks. Every time you create a PR, the compare page defaults to the upstream repo.

The Manual Solution (And Why It's Annoying)

The traditional way to change the base repository is manual:

  1. Click "New Pull Request" on your fork
  2. Notice it's targeting the upstream repository
  3. Click "base repository" dropdown
  4. Select your fork from the list
  5. Choose the correct base branch
  6. Finally create your pull request

You have to do this every time you create a PR. For developers who create dozens of pull requests per week, this becomes incredibly tedious. Plus, it's easy to forget step 2 and accidentally send a PR to upstream.

The Automated Solution: Safe Pull Request

This exact problem is why I built Safe Pull Request - a Chrome extension that automatically changes the default base repository to your fork instead of the upstream repository.

How Safe Pull Request Works

Once installed, the extension:

  1. Detects when you're on a forked repository - It recognizes GitHub's fork architecture
  2. Modifies the compare page automatically - Changes the base repository from upstream to your fork
  3. Respects your default branch - Automatically targets your repository's default branch (whether it's main, develop, or production-final-v2)
  4. Works transparently - Works automatically for personal repos, no configuration needed

Installation Steps

Step 1: Install Safe Pull Request from the Chrome Web Store. The extension works automatically for personal repos - no configuration needed.

Step 2 (Optional): If you're working with organization-owned repositories, you'll need a Professional license. Individually-owned repos work without a license.

To get a license key:

  1. Visit the pricing page
  2. Purchase a Professional license
  3. After purchase, you'll receive a license key
  4. Open the Safe Pull Request extension popup (click the extension icon in your browser)
  5. Enter your license key and GitHub username
  6. Click "Save License Key"

The extension will validate your license and you'll see a "Valid" status displayed.

Step 3: Navigate to your fork on GitHub, click "New Pull Request" or any compare link, and the extension automatically sets the base repository to your fork.

That's it. No manual clicking through dropdowns. No accidentally sending PRs to archived upstream repositories.

Alternative Solutions

If you prefer not to use a browser extension, here are other approaches:

Option 1: Use GitHub CLI

gh pr create --base main --head feature-branch --fill --web

The first time you open a PR from a given repo, it may prompt you for the base repo. Be sure to choose your fork, not the upstream repo.

Option 2: Manual Method

You can manually change the base repository every time:

  1. Click "New Pull Request" on your fork
  2. Click the "base repository" dropdown
  3. Select your fork from the list
  4. Choose the correct base branch
  5. Create your pull request

Note: You must repeat this process every time you create a pull request.

Why This Matters for Your Workflow

Sending an accidental pull request to an upstream repository can be:

  • Embarrassing - Especially if the repo is archived or the maintainers are confused by your PR
  • Time-wasting - You have to close the incorrect PR and create a new one
  • Risky - Your changes might expose proprietary work or reveal information you didn't intend to share
  • Frustrating - Breaking your flow to fix a problem that shouldn't exist

By changing the default base repository behavior, you eliminate an entire category of workflow friction.

Common Questions

Q: Can I still create PRs to the upstream repository when I need to?

Yes! Safe Pull Request changes the default behavior, but you maintain full control. On the "Open a pull request" page, simply click the "compare across forks" link. Then, in the "base repository" dropdown, select the repo you want to open the PR against.

Q: Does this work with private repositories?

Yes, Safe Pull Request works with both public and private repositories. For organization-owned repositories, you'll need a Professional license.

Q: What if my default branch isn't main?

The extension automatically detects and respects your repository's default branch, whether it's main, master, develop, or any custom branch name.

Q: Does this modify my git configuration?

No, Safe Pull Request only modifies GitHub's web interface. Your local git configuration remains unchanged. The extension works by updating the compare page URLs in your browser.

Conclusion

GitHub's default behavior of targeting the upstream repository makes sense for open source contributions, but it's a poor default for developers who work primarily with their own forks. Whether you use Safe Pull Request, GitHub CLI, or manual clicking, the important thing is having a reliable workflow that prevents accidental pull requests to the wrong repository.

Stop wasting time clicking through dropdowns and start focusing on what matters: writing great code.


Try Safe Pull Request: Install the extension and never accidentally PR to upstream again.