Release GitComet Professional launches 28d 06h 25m 04s

Join the waitlist for the early-adopter price Join waitlist

Getting Started Git Basics Merge conflicts

Merge conflicts

Learn why merge conflicts happen in Git and how to resolve them safely.

A merge conflict happens when Git cannot automatically combine two sets of changes.

For merge tool setup and integration details, see Diff and Merge Tools.

Why conflicts happen

Git can merge many changes automatically, but not all of them.

Conflicts usually happen when two lines of work changed the same part of a file in incompatible ways, and Git cannot safely decide which result is correct.

For example, conflicts often appear when:

  • Two branches edit the same lines differently.
  • One branch deletes a file that another branch modifies.
  • A rebase tries to replay a commit onto code that has changed too much.
  • A cherry-pick applies a commit whose context no longer matches cleanly.

Conflicts are normal

A conflict does not mean the repository is broken or that someone made a mistake.

It usually means Git needs a person to decide how two changes should fit together. In collaborative work, that is completely normal.

The important part is to resolve the conflict carefully rather than panic or guess.

What resolving a conflict means

Resolving a conflict means deciding what the final file should look like.

Sometimes that means:

  • Keeping one side and discarding the other.
  • Combining both sets of changes.
  • Rewriting the affected section into a new final version.

After you resolve the file contents, you stage the resolved result so Git knows the conflict has been handled.

Merge conflict markers

When Git cannot merge a file automatically, it may place conflict markers directly into the file.

Those markers show the competing versions so you can inspect them and decide what the final content should be. Until the conflict is resolved and staged, Git treats that file as still unresolved.

Resolving conflicts in GitComet

GitComet opens an interactive resolver for conflicted files. It aligns base, local, and remote inputs, applies high-confidence automatic resolutions on open, and leaves the remaining decisions in an editable result.

A typical conflict resolution flow is:

  1. Select a conflicted file and review the automatically resolved and unresolved blocks.
  2. Move through unresolved conflicts with Shift+F2 and Shift+F3.
  3. Choose an input, keep both, or edit the result until every conflict is resolved.
  4. Choose Save & stage to write the result and mark the file resolved in Git.
  5. Continue the merge, rebase, or cherry-pick that was interrupted.

See interactive conflict resolution for the two-way and three-way selection keys, manual line alignment, and the distinction between saving and staging. The same guide explains how to use GitComet as git mergetool from the command line.

Documentation

Search

move open Esc close

Browse the docs or start typing to filter results.