Branching and merging
Working with branches, fast-forwards and three-way merges, and resolving conflicts.
About 4 hours of study
Learning objectives
- Create and manage branches
- Predict and perform merges
- Resolve conflicts correctly
Lessons
- 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
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
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
- Git: Is this a valid branch name?Easy
- Git: Simulate branches and commitsMedium
- Git: Merged and unmerged branchesHard
- Git: What kind of merge?Easy
- Git: Find the merge baseMedium
- Git: A three-way merge of snapshotsHard
- Git: Count the conflicts in a fileEasy
- Git: Resolve conflicts by choiceMedium
- Git: A line-by-line three-way mergeHard