Version Control CS Thinking Example 3

Follow the full solution, then compare it with the other examples linked below.

Example 3

medium
Two developers both edit the same line of the same file on different branches. What happens when they try to merge? How should this be resolved?

Solution

  1. 1
    Step 1: This creates a merge conflict โ€” the version control system cannot automatically determine which change to keep because both modified the same line.
  2. 2
    Step 2: The developers must manually review both changes, decide which to keep (or combine them), mark the conflict as resolved, and complete the merge. Communication between developers is essential.

Answer

A merge conflict occurs. Developers must manually review and resolve the conflicting changes, then complete the merge.
Merge conflicts are a normal part of team development. Good practices reduce them: communicate about who is working on what, merge frequently, and keep changes small and focused.

About Version Control

A system that records changes to files over time so you can recall specific versions, compare changes, and collaborate without overwriting each other's work. Git is the most widely used version control system, using concepts like commits (snapshots), branches (parallel lines of development), and merges (combining changes).

Learn more about Version Control โ†’

More Version Control Examples