DCubes
Git module

Lesson 8

Conflicts

Create a merge conflict on purpose, resolve markers, and complete the merge.

beginner35 minRun on your machine

What you will be able to do

  • Cause a conflict on the same lines
  • Edit conflict markers and git add the result
  • Finish with git commit (or merge continues)

Why this matters for data work

Two people edit the same SQL metric. Git stops and asks you to choose. Reading conflict markers is a weekly skill.

Concepts

  • Markers: <<<<<<<, =======, >>>>>>>
  • Fix file → git add → complete merge commit
  • Communicate with humans when both changes are valid

Practice on your machine

cd ~/dcubes/git-lab/init-demo
git switch main
git switch -c feature/conflict-a
cat > metric.txt << 'EOF'
revenue = 100
EOF
git add metric.txt
git commit -m "Set revenue 100 on branch A"

git switch main
git switch -c feature/conflict-b
cat > metric.txt << 'EOF'
revenue = 200
EOF
git add metric.txt
git commit -m "Set revenue 200 on branch B"

git switch main
git merge feature/conflict-a
# second merge should stop with a conflict
git merge feature/conflict-b

Expect a conflict. Open metric.txt, pick one value or combine, remove markers:

cat > metric.txt << 'EOF'
revenue = 200
EOF
git add metric.txt
git commit -m "Merge conflict-b: keep revenue 200"
git log --oneline | head

What you should see

  • Merge conflict message on second merge.
  • Clean status after resolving commit.
  • Final file content you chose.

Common mistakes

  • Leaving markers in the file — breaks code/SQL.
  • Aborting without understanding — git merge --abort is OK to reset the attempt.

Next

Remotes