Chuck's Academy

Conflict Resolution in Git

Case Studies: Conflict Resolution in Real Projects

In this chapter, we will analyze real case studies to illustrate how Git conflicts can arise and how they can be resolved. These examples will help to better understand practices and strategies in action, as well as to learn from situations faced by other developers and teams.

Case Study 1: Content Conflict in a Collaborative Project

Context

A development team was working on a new feature for an e-commerce platform. Two developers, Alice and Bob, were working on different branches: feature/Alice and feature/Bob. Both made changes to the same file, product.js, but on different lines of the same block of code.

Case Development

  1. Alice and Bob make their changes:

    • Alice adds a new method in product.js to calculate discounts.
    • Bob modifies the same file to add validations to the product data.
  2. Alice merges her work into develop:

    bash
  3. Bob attempts to merge his work and encounters a conflict:

    bash

    Conflict:

    plaintext

Conflict Resolution

Bob opens product.js and resolves the conflict:

plaintext

Ask me anything