# Merge

> Joining work from one branch into another. Both sets of changes end up in one place.

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** Git Merge

## Think of it like

Think of it like two streams meeting to make one river. The water from both ends up in one place.

## Definition

A merge joins the work from one branch into another. Git compares the two lines of commits and combines the changes. If only one side moved on, Git just moves the branch forward, which is called a fast-forward. If both sides changed, Git makes a new merge commit that ties them together. If both changed the same lines, you get a merge conflict to sort out by hand.

## Example

Emma finishes dark-mode and merges it into main. Her new style is now part of the main code.

## Example code

```console
$ git merge dark-mode
Updating 6dd6d2c..d331bff
Fast-forward
 style.css | 1 +
```

main had not moved, so Git simply caught it up to dark-mode.

## Why it matters

Merging is how separate work becomes one product. It happens many times a day on a busy team.

## Common mistake

Merging without pulling first. You merge into an old copy and then hit surprises when you push.

## Three principles

- **Two lines become one.** Changes from both sides are joined.
- **Fast-forward if it can.** No new commit when one side is still.
- **Conflicts need you.** Same lines changed means a choice.

## Related terms

- [Branch](https://learn.benibix.com/term/development/branch)
- [Merge Conflict](https://learn.benibix.com/term/development/merge-conflict)
- [Rebase](https://learn.benibix.com/term/development/rebase)
- [Pull Request](https://learn.benibix.com/term/development/pull-request)
- [Squash Merge](https://learn.benibix.com/term/development/squash-merge)
- [Fast-Forward Merge](https://learn.benibix.com/term/development/fast-forward-merge)

## Told apart from

- [Merge vs Rebase](https://learn.benibix.com/compare/merge-vs-rebase): Both join two branches. A merge keeps both lines and ties them with a new commit; a rebase moves your commits into one line.

## Taught in

- [Git Merge and Conflicts](https://learn.benibix.com/learn/development-version-control/git-merge-and-conflicts): Git and GitHub, 5/13

---

Source: https://learn.benibix.com/term/development/merge
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
