Branching and merging

Working with branches, fast-forwards and three-way merges, and resolving conflicts.

About 4 hours of study

Learning objectives

Lessons

  1. 1

    Working with branches Intermediate

    Use branches to develop features and fixes side by side without disturbing the main line. Create, list, switch and delete branches, follow naming rules, and see which branches are merged and which still have work of their own.

  2. 2

    Merging Intermediate

    Combine the work of two branches. Recognise when a merge is a fast-forward, find the merge base, and see how a three-way merge takes each change from whichever side made it, and where it must stop with a conflict.

  3. 3

    Resolving merge conflicts Intermediate

    When both branches change the same lines, Git marks the clash in the file and waits for you. Read conflict markers, decide what the result should be, finish the merge, and understand how a line-by-line three-way merge produces the markers.

Module practice

Module quiz

1. You commit on feature. What moves?
2. When does git merge fast-forward?
3. What is the merge base?
4. A file changed only on their side. What does a three-way merge use?
5. Which part of a conflict is between <<<<<<< HEAD and =======?
6. Both sides changed a line in exactly the same way. Is it a conflict?

‹ Inside GitChanging history ›