Skip to content

Instantly share code, notes, and snippets.

@dsherret
Last active November 20, 2025 15:58
Show Gist options
  • Select an option

  • Save dsherret/ddd719da669ab47d5660936f8b713b87 to your computer and use it in GitHub Desktop.

Select an option

Save dsherret/ddd719da669ab47d5660936f8b713b87 to your computer and use it in GitHub Desktop.
Avoid opening PRs from your `main` branch

I highly recommend not opening PRs from the main branch of your fork.

Why?

  1. Maintainers usually can't push fixes to your main branch. GitHub often blocks maintainers from making changes directly to a contributor's main branch.
    • I regularly need to make small edits (sometimes just one line) to get a PR ready to merge.
    • This mostly works fine if the PR comes from a non-main branch, but not from main.
  2. It complicates keeping your fork in sync. After your PR is merged, your fork's main branch ends up diverging from the upstream main.
    • You then need to reset your main branch to match upstream, or merge the upstream changes back in.
    • Both are avoidable if you simply work from feature branches.

Recommended Workflow

  1. Fork and clone the repo.
  2. Create a new branch from main.
  3. Make your changes.
  4. Commit and push to that branch.
  5. Open a PR from that branch.
  6. After your PR is merged, switch to main and pull the latest upstream changes.

This workflow lets maintainers push fixes to your PR branch and makes it easier for you to keep your fork clean and in sync with upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment