October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Merge a Pull Request on GitHub

A practical guide to merging GitHub pull requests, selecting a merge method, and resolving common blockers such as pending checks, missing permissions, and conflicts.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To merge a pull request on GitHub, open it, verify its base branch, satisfy any required reviews and status checks, choose an enabled merge method, and confirm. You need write permission, and repository settings determine which methods are available.

Merge a pull request on GitHub

  1. Open the pull request. Check its base branch—the branch receiving the changes—and make sure it is the intended destination. The head branch is the branch containing the proposed changes.
  2. Check whether it is ready. Review the pull request’s status for required approvals, status checks, or merge conflicts. Resolve any conflicts and meet the repository’s requirements before proceeding.
  3. Choose an available merge method. In the merge area, select the method enabled for this repository. You need write permission to merge.
  4. Review the commit details. For merge commit or squash, check the commit message and description GitHub presents; depending on repository configuration, you may be able to edit them.
  5. Confirm the merge. If requirements are still pending, you may be able to enable auto-merge instead, provided the repository has enabled it and you are authorized to do so.

Choose the right merge method

GitHub offers three standard methods. The repository’s configuration and applicable branch rules determine which appear as options.

Method Result on the base branch Useful when Tradeoff
Merge commit Preserves the pull request branch’s commits and adds an explicit merge point. GitHub’s default merge method uses --no-ff. You want the branch’s commit history and a visible record of the merge. Adds a merge commit and cannot be used when a linear-history rule applies.
Squash and merge Combines the pull request’s commits into one commit on the base branch. The pull request represents one logical change or contains small fixup commits. Individual commits are not retained separately. Reusing the same long-lived branch after a squash can make already-merged changes appear in a later pull request and increase conflict work.
Rebase and merge Places the pull request’s commits individually onto the base branch without a merge commit, producing linear history. You want linear history and the pull request’s commits are already organized clearly. GitHub creates new commit SHAs and updates committer information; originally empty commits are dropped.

Repository maintainers configure which methods are allowed. A rule requiring linear history requires squash or rebase merging to be available. A merge queue can also control how a queued pull request is merged.

Why the merge button or a method may be unavailable

  • You lack permission: Merging requires write permission to the repository.
  • Reviews or checks are still pending: Required approvals and status checks must satisfy the repository’s rules.
  • The pull request has conflicts: Resolve them before merging. GitHub provides a browser editor for simple conflicts; more complex cases can be resolved from the command line.
  • The method is disabled: Check the repository’s allowed merge methods and applicable branch rules. A linear-history requirement rules out merge commits.
  • The pull request is in a merge queue: Queue behavior can differ from a standard merge and may determine the merge method.

Use auto-merge when requirements are pending

If the repository has enabled auto-merge, an authorized user can enable it while required reviews or status checks are pending. GitHub then merges the pull request after its requirements are met. Auto-merge is not available in every repository or plan; check GitHub’s current documentation for eligibility and setup details: Automatically merging a pull request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to resolve conflicts locally

For simple conflicts, GitHub’s browser conflict editor may be sufficient. For complex conflicts, resolve them locally: rebase workflows can require conflict resolution and a force push. Handle force pushes carefully because they rewrite branch history and can affect collaborators.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.