How to Change the Default Base Repository for GitHub Forks

The Problem: When you work with a GitHub fork, and you open a pull request, by default it gets opened against the upstream (original) 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 Solution: Safe Pull Request automatically changes the default base repository to your fork, eliminating the need to manually change it every time you create a pull request.

Why This Matters

GitHub's default behavior makes sense for open source contributions, but creates problems 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

Step-by-Step Guide

Step 1: Install Safe Pull Request

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

Step 2 (Optional): Get a License Key for Organization-Owned Repos

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

Go to your forked repository on GitHub.

Step 4: Create a Pull Request

Click "New Pull Request" or any GitHub compare link. Safe Pull Request automatically changes the base repository from upstream to your fork.

Step 5: Verify the Target

Confirm that the base repository is set to your fork (not the upstream repository). The extension handles this automatically, but you can always manually change it if needed.

Step 6: Create Your PR

Complete your pull request as normal. Your PR will now target your fork by default, preventing accidental pull requests to upstream repositories.

Alternative Methods (Without Safe Pull Request)

Manual Method

If you prefer not to use the extension, you can manually change the base repository:

  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.

GitHub CLI Method

Use the 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.

Common Questions

Can I still create pull requests to the upstream repository?

Yes! Safe Pull Request changes the default behavior, but you maintain full control. You can always manually change the base repository back to upstream when you want to contribute to the original project.

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.

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.

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.

Get Started

Ready to stop accidentally creating pull requests to the wrong repository?

Install Safe Pull Request from the Chrome Web Store