THE GITHTML FIELD GUIDE
Choose the correct base and head for a GitHub pull request
The base branch is the destination a pull request proposes to change; the head branch contains the proposed work. In a fork contribution, the base repository is usually the original project and the head repository is your fork. Verify both owners and branch names, then inspect the resulting commits and files before creating the request.
Read direction before reading the patch
A pull request is directional. Swapping base and head changes the question being asked and can produce a surprising diff. The same branch names can exist in several forks, so owner names are part of the identity, not decorative text. A release backport may target a maintenance branch rather than the default branch.
Start from the intended outcome: which repository and branch should contain the fix after merge? Then identify the branch that holds only the proposed work. If the head branch contains unrelated commits, choosing a different base to hide them is usually not a substitute for preparing a coherent contribution branch. Inspect ancestry and scope first.
Use the comparison as a preflight
GitHub’s creation flow lets you select base and compare branches, including across forks. Read the commit list and Files changed before submitting. A large unexpected diff is evidence to investigate the branch selection or history, not a reason to write a vague description and let reviewers sort it out.
- Confirm base owner, base branch, head owner, and head branch as four separate fields. Write them in your own words before proceeding.
- Check that the changed paths match the task and that no credential, generated dump, or unrelated experiment appears in the proposal.
- For a backport, explain why the maintenance branch is the destination and identify any adaptations from the original fix.
Recheck after changing the base
Changing a pull request’s base can alter the comparison and review context. Inspect the entire resulting file list and notify reviewers when the target changes materially. Existing comments may refer to lines or assumptions from the earlier comparison, so do not treat their presence as proof that the new proposal has been reviewed.
The head branch can also receive new commits while the request stays open. That updates the proposal without changing its number. Keep the description aligned with current scope, and preserve a concise explanation of major changes during review. The request is ready for meaningful review when its direction is correct and its patch expresses the intended contribution, not merely when GitHub allows the creation form to be submitted.
- For a release fix, confirm whether maintainers expect the proposal against the maintenance branch or the main development branch first. Those targets may contain different APIs and tests. The correct base is determined by the release workflow, not by whichever selection produces the smallest displayed patch.
- If changing the base makes unrelated commits appear, pause and inspect the topic branch’s ancestry. A branch created from another unfinished feature may carry that feature into the new comparison. Prepare the intended standalone change rather than asking reviewers to mentally subtract the unwanted prerequisite.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.