Chuck's Academy

Git and GitHub

Conflict Resolution

In this module, we will learn how to handle and resolve conflicts in Git. Conflicts occur when Git cannot automatically merge changes made in different branches. It is crucial to know how to resolve these conflicts to maintain an efficient workflow.

What is a conflict?

A conflict in Git occurs when two branches have made changes to the same lines of a file or when a file has been deleted in one branch and modified in another. Git cannot automatically decide which changes to keep, so it requires manual intervention.

Detecting conflicts

During merge

When attempting to merge a branch, Git may encounter conflicts. For example:

bash

Git will attempt to automatically merge the changes, but if it finds conflicts, it will display a message indicating that there are conflicts that need to be resolved.

Viewing conflicts

When there are conflicts, Git marks the conflicting file with the following tags:

bash

Ask me anything