Merge vs Rebase — When to Use Which — Concept Check
Questions on Merge vs Rebase — When to Use Which. Merge preserves true history with a merge commit; rebase replays commits onto a new base for a clean linear history. The golden rule: never rebase commits that have been pushed to a shared branch.
Questions in this quiz
7 questions on Merge vs Rebase — When to Use Which — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a feature branch that diverged from the main branch a week ago. To prepare for a pull request, you want a clean history. What should you do?
- ARebase the feature branch onto the main branch.
- BCreate a new branch from main and cherry-pick commits.
- CForce push the feature branch to main.
- DMerge the main branch into the feature branch.
2.A developer rebases a shared branch and force-pushes it. What issue might arise for their teammates?
- AThe rebase will automatically resolve conflicts.
- BTeammates will have duplicate commits.
- CThe branch history will become too linear.
- DTeammates' commits may become orphaned.
3.After rebasing a feature branch onto main, what is the next step to integrate it back into main?
- ACreate a new branch from main and cherry-pick commits.
- BMerge the feature branch into main with a fast-forward merge.
- CRebase the main branch onto the feature branch.
- DForce push the feature branch to main.
4.Why should you avoid rebasing commits that have been pushed to a shared branch?
- AIt makes the history too complex to understand.
- BIt creates parallel histories and confuses teammates.
- CIt automatically deletes old commits.
- DIt prevents future merges from being possible.
5.A developer wants to preserve the exact history of how work was integrated into a project. Which method should they use?
- AUse fast-forward merges to maintain linearity.
- BRebase, as it rewrites history for clarity.
- CCreate a new branch and cherry-pick commits.
- DMerge, as it preserves true history with a merge commit.
6.You notice a teammate force-pushed a rebased branch to the remote main branch. What should you do next?
- AIgnore the change and continue working.
- BCommunicate with the team to resolve any orphaned commits.
- CRebase your own branch onto the new main branch.
- DMerge your branch with the new main branch.
7.Which of the following is a key characteristic of a merge commit?
- AIt is used only for local branches.
- BIt has two parent commits, preserving branch history.
- CIt automatically resolves all conflicts.
- DIt rewrites commit hashes for a linear history.