Branching and Integration Lab
What This Practice Page Is For
This lab forces you to branch, merge, rebase, and resolve one real conflict in a controlled environment.
The goal is not speed. The goal is to make branch history legible.
Retrieval Prompts
- Why is creating a branch cheap in Git?
- What is the main difference between merge and rebase?
- When is rebasing a bad idea?
Compare and Distinguish
Write one careful paragraph comparing:
- fast-forward merge
- merge commit
- rebase followed by fast-forward merge
Your answer should mention history shape, not just final file content.
Common Mistake Check
Explain why each move is risky:
- Rebasing a branch that teammates already pulled.
- Deleting a branch before confirming the work is integrated.
- Resolving a merge conflict by choosing a side without reading the actual code.
Mini Application
Use a throwaway repository and do the full sequence:
- create
mainwith one initial commit - create
feature-aand make two commits - return to
mainand make one overlapping commit - rebase
feature-aontomain - inspect the graph
- create
feature-bfrommain - create a conflicting edit on
feature-b - merge
feature-bintomainand resolve the conflict manually - inspect the graph again
Evidence Check
You are done only when you can show:
- one rebased local branch
- one successful merge
- one manually resolved conflict
- one written explanation of why the final history looks the way it does
If You Got Stuck
Revisit:
Integrated Practice Expansion
Run this extra pass in a disposable repository before you use rebase on a real project.
- Create
mainwith two commits:README.mdandnotes/git-lab.md. - Create
feature/history-cleanupand make three commits: one useful change, one typo fix, and one accidental debug file. - Use interactive rebase to squash the typo fix into the useful change and drop the accidental file commit.
- Merge
mainforward once, then repeat the same exercise by rebasing the unpublished feature branch ontomain. - Draw both commit graphs and write which history is easier to review and why.
Evidence check:
git log --oneline --graph --decorate --allbefore and after cleanup- one sentence explaining why rewriting unpublished work is acceptable here
- one sentence explaining why the same operation would be risky after teammates have based work on the old commits