Interactive Rebase — Rewrite History Like a Pro — Concept Check
Questions on Interactive Rebase — Rewrite History Like a Pro. git rebase -i lets you reorder, squash, edit, split, or drop commits before merging. It is the tool for turning a messy development history into clean, reviewable commits.
Questions in this quiz
8 questions on Interactive Rebase — Rewrite History Like a Pro — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a commit history with several 'WIP', 'fix typo', and 'add tests' commits. Before submitting a PR, you want to clean it up. Which git command should you use?
- Agit rebase -i
- Bgit merge
- Cgit commit --amend
- Dgit cherry-pick
2.During an interactive rebase, you encounter a commit that combines unrelated changes. What should you do to separate these changes into distinct commits?
- AUse 'reword' to change the commit message
- BUse 'edit' to pause and split the commit
- CUse 'squash' to combine it with the previous commit
- DUse 'drop' to remove the commit
3.You want to remove a commit that contains only debugging code before merging your branch. Which command should you use in interactive rebase?
- Asquash
- Breword
- Cdrop
- Dpick
4.A developer believes they can use interactive rebase on commits that have already been pushed to a shared branch. What is the risk of doing this?
- AIt will automatically fix conflicts
- BIt will create duplicate commits
- CIt will merge branches automatically
- DIt can rewrite history and cause issues for others
5.You have two commits: one with a typo fix and another with a feature implementation. You want to combine them into a single commit while keeping both messages. Which command should you use?
- Adrop
- Bsquash
- Cfixup
- Dreword
6.A developer uses 'fixup' during an interactive rebase. What happens to the commit message of the commit being fixed up?
- AIt is discarded
- BIt is combined with the previous message
- CIt is edited interactively
- DIt is kept unchanged
7.You want to change the commit message of a commit during an interactive rebase. Which command should you use?
- Adrop
- Breword
- Cpick
- Dsquash
8.A developer thinks using 'pick' in interactive rebase will allow them to edit the commit message. What is the actual function of 'pick'?
- AIt removes the commit
- BIt combines commits
- CIt allows editing the commit message
- DIt uses the commit as-is