World map

 

BM: Baca dalam Bahasa Melayu

World 5: Teamwork

Conflicts in a PR

You will learn: why a pull request gets a conflict, and how to fix it.

The problem

You and Ravi both changed the README’s second line. His PR merged first. Now your PR says it has a conflict: Two changes hit the same spot. You pick what stays.. Did you break something?

Pick one answer.

Try it

Git marks the clash with conflict markers: The lines <<<<<<<, ======= and >>>>>>> that Git puts around a clash.. Your line sits on top. Main’s line sits below. Tap the three marker lines.

Tap every marker line.

0 of 3 found

Try it

Now fix it. Keep the words you want. Delete all three marker lines.

No markers left, and at least one line about Friday.

Preview

Club Site

<<<<<<< my-tagline Code, snacks and friends. Every Friday!

We meet every Friday after school.

main

1 of 2 goals done

Predict

GitHub’s web editor fixes simple line clashes. Here, main deleted a file that your branch changed. Can the web editor fix that?

Pick one answer.

Check

Put the steps to fix a conflict on GitHub in order. First at the top.

First step at the top. Put these in order. Use the arrows, or drag.

  • Open the conflict from the PR
  • Delete the conflict markers
  • Commit the merge
  • Pick the words to keep
  • Mark the file as resolved

Check

Fewer conflicts next time. Good habit, or needs work?

Swipe right for good, left for needs work. Or use the buttons.

1 / 4

Keep PRs small and merge them soon

Keep PRs small and merge them soon

You did it!

You can now fix a conflict in a pull request without panic.

Go deeper (optional)

On GitHub, fixing a conflict makes a merge commit. It merges main into your PR branch. Not just the clashing lines: all of main comes in. On your computer, switch to your branch and merge main into it. Fix the files, then git add and git commit. Push, and the PR updates. World 3 shows merging in detail.