LESSON 7
Merging
Learning objective: Combine branches with merge.
Understand
Merging brings a branch's work back into main.
When a feature is ready, switch to main and git merge the feature branch to combine the changes. Sometimes Git needs your help to resolve conflicts when the same lines changed in both branches.
Analogy: Merging is like combining two drafts of a document into one final version.
See It in Action
Merging a feature:
git switch main
git merge feature-navHow it works: You move to
main first, then merge the feature branch so its commits become part of main.Try It Yourself
- Finish work on a feature branch.
- Switch back to main.
- Merge the feature branch in.
Quick Quiz
What can happen when the same lines changed in both branches?
Challenge
Merge a feature branch into main and confirm the changes are present.
Success condition: Your main branch now contains the feature branch's work.
+10 XP
Lesson Complete
You answered correctly and completed the required practice. Your progress has been saved on this device.
Continue to next lesson →