Skip to content
  • Resolving Conflicts · Git & GitHub

Resolving Conflicts

LearnViaNotes @learnvianotes· 1 min read

What happens when Git cannot merge automatically, and how to resolve it manually.

How Git Flags Conflicts

When a conflict occurs, Git marks the conflict boundaries directly in the affected files using conflict markers:

<<<<<<< HEAD
This is my local code change on main branch.
=======
This is the incoming code change from feature branch.
>>>>>>> feature-branch

Step-by-Step Conflict Resolution

  1. Open the conflicted files in an editor (VS Code highlights these sections).

  2. Inspect the code and manually choose which changes to keep, removing the markers (<<<<<<<, =======, >>>>>>>).

  3. Stage the resolved files: git add [filename].

  4. Finalize the merge by committing: git commit -m "Resolve merge conflict".

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report