Merging is the moment a branch stops being a proposal and becomes part of the product, and on many projects it also publishes the change to real users. AI agents and app builders now open a growing share of pull requests, yet none of that work reaches the product until someone merges it. Knowing what a merge does, and what can stop one, has become part of shipping product work.
In this glossary topic:

What is a merge?
A merge is the Git operation that combines the changes from one branch into another. It joins 2 lines of work that split apart, such as a redesign on its own branch and the main branch everyone relies on, into a single history that contains both. On GitHub, merges usually happen at the end of a pull request, when someone selects the merge button and the branch's commits land in the base branch.
Merging doesn't remove anything. The branch still exists afterwards, its commits now appear in the base branch's history as well, and the pull request keeps the full record of what changed and why. A merge is the point where proposed work officially becomes part of the project.
How does a merge work?
Git starts by checking how far the 2 branches have drifted apart. If nothing new has landed on the base branch since the other branch began, Git can simply move the base branch forward to the newest commit, which Pro Git, Git's official book, calls a fast-forward. If both branches have moved on, Git compares 3 snapshots: the tip of each branch and the most recent commit they share, called the common ancestor. From those, it builds a combined version and records it as a merge commit, a special commit with 2 parents instead of one.
Git does most of this without help, even when both sides edited the same file, as long as they changed different lines. GitHub's default merge button always creates a merge commit, even when a fast-forward would work, so each merged pull request leaves a marker in the history, such as Merge pull request #1 from contactpage. Because Git compares changes line by line, 2 people can edit the same file and still merge cleanly.
How does a merge differ from a rebase?
A rebase is the main alternative to a merge. Instead of joining 2 histories with a merge commit, it takes each commit from one branch and replays it on top of the other, as if the work had started from the latest version all along. The result is a straight line of commits with no merge commit. Pro Git notes that the final files are identical either way. Only the shape of the history differs.
Because replayed commits get new IDs, a rebase rewrites history, and Pro Git sums up the risk in one rule: never rebase commits that other people may already have built on. GitHub's merge button offers both approaches, plus a third:
- Create a merge commit keeps every commit from the branch and adds one that joins the 2 histories
- Squash and merge combines all of the branch's commits into a single new commit on the base branch
- Rebase and merge adds each commit to the base branch one by one, with new IDs and no merge commit
Squashing suits short-lived branches full of commits like wip and fix typo, while a merge commit preserves the detail of longer work. The repository's settings decide which methods are available. The method changes how the history reads, never what ends up in the files.
What is a merge conflict?
A merge conflict happens when Git can't combine 2 sets of changes on its own. Usually both branches changed the same lines of the same file in different ways, or one branch edited a file that the other deleted. Git refuses to guess which version is right, so it marks the competing lines in the file, and on GitHub the merge button stays inactive until someone resolves them.
Consider the price of a cupcake on a bakery's website. On main, someone changes it to $4. On a branch, someone else changes the same line to $5. Both edits are valid on their own, and the right answer depends on a decision made outside the files, which is why the How to Resolve Merge Conflicts on GitHub lesson treats a conflict as a question for people more than a technical fault. Simple conflicts can be fixed in GitHub's web editor, while others need Git tools outside the browser. Conflicts grow the longer branches live apart, so merging often keeps them small.
Why does merging matter for designers and product teams?
On many projects, merging into main starts a deployment. A workflow or hosting service picks up the change and publishes it, so the merge button is effectively the publish button, and a merged mistake can reach customers within minutes. That makes the merge the last natural checkpoint for anyone who cares how a product looks, reads, and behaves.
GitHub shows whether a pull request is ready in the merge box at its bottom: the approvals it has, the status checks that build and test it, and whether its branch conflicts with the base. Repository rules can require all 3 before the button works. Readiness is also a judgment call. Even with everything green, holding a merge until after a launch or a weekend can be the wiser choice, since problems are easiest to fix while people are around. Merging is a product decision as much as a technical one.
How has merging changed with AI?
Merging has had to keep pace with AI-written work. Agent branches tend to fill with small generated commits, and squashing them on merge turns dozens of steps into one entry that's easy to read and revert. Auto-merge merges a pull request the moment its required reviews and checks pass, and it switches itself off if someone without write access pushes new changes. On busy branches, a merge queue lines pull requests up in order and tests each one together with the changes ahead of it, so incompatible changes never break the branch.
AI is taking on the blockers too. With Copilot cloud agent enabled, GitHub's merge box offers a Fix with Copilot button that resolves conflicts automatically, and GitHub's documentation describes an Agent Merge option that has Copilot fix failing workflows and conflicts while auto-merge waits. A tool can merge the text, though, without knowing which decision was made in a meeting. Green marks need the same care: by GitHub's own account, a skipped check reports success and won't block a merge even when it's required, a gap the Guide to GitHub Status Checks for AI Code lesson unpacks. The more of a merge that runs on its own, the more a person needs to know what the result should say.
What does a merge look like in practice?
On GitHub, a merge happens in the merge box at the bottom of a pull request. When everything lines up, the box lists the checks that passed, confirms the branch has no conflicts with its base, and offers a green Merge pull request button with a menu for choosing the merge method.

A merge is the moment work becomes part of the project, which is why GitHub checks it before the button turns green. From the lesson How to Merge Pull Requests Safely on GitHub.
When a conflict gets in the way, the same box changes. It names the conflicting files, grays out the merge button, and offers a Resolve conflicts button when the fix is simple enough for the browser. The merge box shows what's blocking a merge, never whether the change itself is right.

When two changes collide, Git stops and waits for a person to decide which version the project keeps.





