Why branches and merges exist

Published on 2026-09-12 by frfrand

A branch is a 41-byte pointer, and that changed how teams work. What a conflict really is and when it is better to merge or rebase.

Why branches and merges exist

Short answer: branches exist to work in parallel without stepping on each other, and in Git they are cheap because a branch is just a pointer to a commit. A conflict appears only when two changes touched the same lines differently. Merge preserves history as it happened; rebase rewrites it in a straight line and should not be used on branches that others already have.

Before Git, creating a branch was an operation. In some systems it involved copying the entire project on the server and could take minutes. The cultural consequence was that almost no one branched: everyone worked on the trunk and prayed.

Git changed that through a very simple design decision.

A branch is a pointer

Literally:

$ cat .git/refs/heads/feature-login a3f91c2e8d4b7a6f9c1e2d3b4a5f6e7d8c9b0a1f

That is the entire branch. A file with a hash inside: 40 characters of SHA-1 and a newline, 41 bytes.

Creating a branch is writing that file. That is why it is instant, why it takes no space, and why Git's workflow pushes you to create one for each thing.

When you make a commit while on that branch, the file is updated with the new hash. The branch "advances". Nothing more.

What a conflict really is

There is a very widespread misconception: that a conflict means Git could not merge.

Git automatically merges almost everything. If you touched file A and another person touched file B, there is nothing to decide. If you both touched the same file but in different parts, neither.

A conflict appears only when two people changed the same lines in a different way. Then Git could choose one, and it refuses, because choosing wrong is worse than asking.

Seeing a conflict is not a failure of the process: it is the tool warning you that there is a human decision pending. Teams that have conflicts all the time do not have a Git problem: they have branches that live too long and touch the same things.

Merge and rebase, without religion

Both integrate the work of one branch into another. They differ in what remains written afterwards.

merge creates a new commit with two parents. The history remains as it happened: two lines that separated and joined. It is honest and rewrites nothing.

rebase takes your commits and reapplies them on top of the other branch, as if you had made them afterwards. The history remains in a straight line and reads better. But they are new commits, with new hashes: the originals remain orphaned.

From there comes the only rule that truly matters:

Do not rebase a branch that other people already have. Their copies still point to the old commits, and when trying to integrate, duplicates and confusion will appear.

On your own branch, before sharing it, rebase is excellent: it lets you clean up intermediate commits like "fix", "now yes" and "revert".

A combination that works very well in teams: rebase to tidy up your branch before opening the pull request, merge to integrate it.

The part that helps the most and is least talked about

Almost all branch problems are solved before they even exist, with a habit: short branches.

A two-day branch touches little, integrates without drama and almost never generates conflicts. A three-week branch becomes an integration project in itself.

If a task is large, the answer is not a long branch: it's splitting the task into pieces that can be integrated separately, even if they remain behind a switched-off toggle.

Why branches and merges exist
Why branches and merges exist

Example with a real deployment

Imagine that you add a new form. You work on feature/formulario, open a pull request to review the change, and merge into the stable branch when the tests pass. Only then do you publish the version to the server.

In ArduMaker, the VPS runs the code that was deployed, not all branches in your repository. That's why it's important to distinguish between branch, commit, and published version. If a merge introduces a problem, first identify the deployed commit and decide whether it's worth reverting it or publishing a fix.

Related: Merge conflicts · Review with pull requests.

Frequently asked questions

What exactly is a merge conflict? It's Git warning that two branches changed the same lines in different ways and that a human decision is needed. Everything else merges automatically.

Merge or rebase? Rebase to organize your own branch before sharing it; merge to integrate it. Never rebase a branch that other people have already pulled.

How do I avoid so many conflicts? With short branches: a two-day branch touches little and integrates without drama. If the task is large, split it and integrate each part behind a feature flag turned off.

  • Git
  • ramas
  • merge
  • colaboración
  • flujo de trabajo

Keep reading

All articles · VPS plans