Resolving Merge Conflicts

When Git pauses a merge because files overlap, and how to safely resolve the conflict markers.

Version Control6 min readConcept 12 of 29

Why Git Halts

A **merge conflict** occurs when you attempt to merge two branches, but Git finds that the *exact same part of the same file* was modified differently in both branches.

Because Git cannot definitively know which developer's changes are the 'correct' ones to keep, it halts the merge process and asks for a human to review the changes.

Why it matters

In web development teams, you frequently have multiple developers working on shared files simultaneously—such as a common index.html or a global styles.css file.

Understanding how to correctly resolve conflicts is crucial. If done incorrectly, you might accidentally overwrite a teammate's hard work, introduce severe syntax errors, or break the application build.

How it works (The Markers)

When Git pauses the merge, it modifies the conflicting files by injecting standard conflict-resolution markers: <<<<<<< HEAD (start of your current code), ======= (the divider), and >>>>>>> branch-name (end of incoming code).

To resolve it, you must manually edit the file to keep the code you want, and completely delete all the Git markers.

Check yourself

Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.

  1. 1What is the purpose of the `=======` marker in a file with a Git merge conflict?
  2. 2After manually editing a file to resolve a merge conflict and removing all the conflict markers, what is the exact next step you must take?
  3. 3Why does Git pause and halt the merge process when it encounters a merge conflict?

Remember this

  • Conflicts happen when lines overlap. Git halts to ask for your help.
  • The markers are <<<<<<<, =======, and >>>>>>>.
  • Use VS Code's 'Accept Current' / 'Accept Incoming' to safely resolve and delete the markers.

Done with this concept?

Mark it complete to track your progress. No login needed.