DevOps Bootcamp · Lesson

Manual Merge Conflict Resolution

Learn to manually identify and resolve merge conflicts that arise when integrating divergent branches.

Lesson 1 of 411 steps

Manual Merge Conflict Resolution is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.

Understanding Merge Conflicts

Welcome to the world of merge conflicts! Don't worry, they're a normal part of collaborating with Git. A merge conflict happens when Git can't automatically figure out how to combine changes from two different branches.

This usually occurs when two branches modify the same lines in the same file in different ways, or when one branch deletes a file that another branch modified.

Why Conflicts Arise

Git is incredibly smart at merging most changes automatically. However, it needs human help when faced with ambiguity. Here are common scenarios:

  • Same line, different changes: Two people edit the exact same line of code differently.
  • One deletes, one modifies: One branch deletes a file, while another branch modifies it.
  • Rename vs. Modify: A file is renamed in one branch and modified in another.

Detecting Conflicts with Git

When a merge conflict occurs, Git won't complete the merge automatically. Instead, it will pause the process and tell you which files have conflicts. You'll see a message like this:

Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts and then commit the result.

Using `git status` for Conflicts

After an automatic merge fails, your repository will be in a 'merging' state. You can use git status to see which files are conflicting. These files will be listed as 'unmerged paths'.

git status

Deciphering Conflict Markers

Git inserts special markers directly into the conflicting files to show you where the problem is. These markers help you identify the different versions of the code:

  • <<<<<<< HEAD: Marks the beginning of your current branch's changes.
  • =======: Separates the changes from the two branches.
  • >>>>>>> branch-name: Marks the end of the incoming branch's changes.

Inside a Conflicting File

Let's look at an example. Imagine you have a file hello.txt. Your main branch changed it to 'Hello from main', and a feature branch changed the same line to 'Greetings from feature'. When merging feature into main, the file will look like this:

<<<<<<< HEAD
Hello from main
=======
Greetings from feature
>>>>>>> feature

Manually Resolving the Conflict

Your job is to open the conflicting file (e.g., hello.txt) in your text editor. Then, you manually edit the file to remove the conflict markers and choose the desired content. You can combine parts, pick one version, or write something entirely new.

For our hello.txt example, if we want both messages, we might edit it to:

Hello from main and Greetings from feature!

Staging Resolved Changes

Once you've manually edited the file and removed all conflict markers, you need to tell Git that you've resolved the conflict. You do this by staging the file with git add.

Repeat this for every file listed as 'unmerged paths' by git status.

git add hello.txt

Completing the Merge Commit

After all conflicting files are staged, the merge is ready to be committed. Git will usually provide a default merge commit message, which you can accept or modify. This final commit completes the merge process.

git commit -m "Merged feature branch, resolved conflict in hello.txt"

Conflict Resolution Check

You've successfully resolved a merge conflict. Now, let's test your understanding of the next crucial step after manually editing a conflicting file.

Recap: Manual Conflict Resolution

You've learned how to manually resolve merge conflicts! It's a fundamental skill for any developer.

  • Conflicts happen when Git can't auto-merge changes.
  • git status reveals unmerged files.
  • Conflict markers (<<<<<<<, =======, >>>>>>>) show divergent code.
  • Manually edit files, remove markers, and choose the final content.
  • Stage resolved files with git add.
  • Complete the merge with git commit.

Practice makes perfect! Conflicts might seem intimidating at first, but with these steps, you'll master them.

Free to start

Learn DevOps Bootcamp with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
142
Lessons
568

Frequently Asked Questions

Is the “Manual Merge Conflict Resolution” lesson free?

Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Manual Merge Conflict Resolution”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.

What will I learn in “Manual Merge Conflict Resolution”?

Learn to manually identify and resolve merge conflicts that arise when integrating divergent branches. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “Manual Merge Conflict Resolution” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Manual Merge Conflict Resolution
  2. Interactive Rebasing for History
  3. Cherry-picking Commits
  4. Using Git Rerere to Reuse Conflict Resolutions
← Back to DevOps Bootcamp