Skip to main content

Getting Started with Git — Chapter 4 / 4

Resolving conflicts

Conflicts can feel scary. But they are completely normal. This chapter teaches you to understand them, read them, and resolve them calmly.

Why conflicts happen

Key term: conflict

A conflict happens when two branches have changed the same lines of the same file. Git does not know which version to keep. So it asks you to choose. It's like two people editing the same sentence in a shared document at the same time.

Complete guide on merge conflicts →

Most of the time, Git merges automatically without any problem. A conflict only happens when the same lines were changed differently in both branches.

Conflicts are not errors. They are a sign that two people (or two branches) worked on the same part of the code. This is perfectly normal in a team project.

Think of it this way: two people are decorating the same room. One paints the wall blue. The other paints it green. Someone needs to decide which color stays. That someone is you.

Continue on the app

This chapter is available on the GitQuest mobile app. Download it free to continue your Git learning journey.