Merging Branches & Conflict Resolution
Merging merges isolated branch features back into your active branch. Conflict resolution handles overlapping file modifications manually.
1 Merging & Conflicts
Shell — Merging Branches
# 1. Switch to the target merge branch (e.g. main)
git checkout main
# 2. Merge the feature branch into main
git merge feature-about
# Fast-forward merges occur when no commits occurred on target
# Recursive merges occur when conflicts require a merge commit
Text — Merge Conflict Markers
<<<<<<< HEAD
Content on main branch (target)
=======
Content on feature branch (incoming)
>>>>>>> feature-about
To resolve conflict errors, open the marked files, choose which block to preserve, delete the markers, stage the file, and commit the merge.
2 Code Challenge
Challenge: Trigger a merge conflict by editing the same line of a text file on both
main and a feature branch. Attempt a merge, resolve the conflict markers manually, and commit.