Lesson 07
Merge
Merge is a Git history operation: it combines another branch into the branch you currently have checked out.
Visual Explanation
Ready to run git merge --no-ff feature/login.
Keep These Ideas
- Receiving branch
- The branch you are on receives the other branch's commits.
- Merge commit
- A checkpoint that connects both lines of history. This is separate from a hosted review page.
- Conflict
- Git asks for help when it cannot combine overlapping changes automatically.
The Real Command
Terminal
git merge --no-ff feature/loginExample Output
Merge made by the 'ort' strategy.
app.js | 12 ++++++++++++
1 file changed, 12 insertions(+)Run this from main to combine feature/login and keep a visible merge checkpoint.
Command Details
git switch mainChoose the receiver first. Switch to main before merging the feature into it.
git merge feature/loginDefault merge. Git chooses a fast-forward or merge commit when appropriate.
Example Output
Updating a1b2c3d..d4e5f6a
Fast-forward
app.js | 12 ++++++++++++
1 file changed, 12 insertions(+)git merge --abort--abort cancels an unfinished merge. Use it to return to the pre-merge state when a conflict becomes confusing.
Knowledge Check
Join Two Lines of Work
Use Git to combine histories while understanding the receiving branch, merge commits, and conflicts.
Question 1 of 5
- Question 1: current
- Question 2: not started
- Question 3: not started
- Question 4: not started
- Question 5: not started