I highly recommend not opening PRs from the main branch of your fork.
- 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-
mainbranch, but not frommain.
- It complicates keeping your fork in sync. After your PR is merged, your fork's
mainbranch ends up diverging from the upstreammain.- You then need to reset your
mainbranch to match upstream, or merge the upstream changes back in. - Both are avoidable if you simply work from feature branches.
- You then need to reset your
- Fork and clone the repo.
- Create a new branch from
main. - Make your changes.
- Commit and push to that branch.
- Open a PR from that branch.
- After your PR is merged, switch to
mainand 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.