Practice advanced Git vocabulary: interactive rebase, cherry-pick, git bisect, reflog, and squash commits — operations used to manage complex repository histories.
0 / 5 completed
1 / 5
'Interactive rebase cleans up the commit history.' What can you do with git rebase -i?
git rebase -i (interactive rebase) opens a list of commits you can manipulate: pick (keep), squash (combine with previous), fixup (squash without keeping message), reword (edit message), drop (remove), and reorder by changing the list order. It's typically used to clean up messy work-in-progress commits into a coherent history before submitting a pull request.
2 / 5
'Cherry-pick applies a specific commit to another branch.' When would you use git cherry-pick?
git cherry-pick takes the changes from a specific commit (identified by its hash) and applies them as a new commit on the current branch. Common use cases: backporting a critical bug fix to an older release branch, applying a hotfix to both main and a release branch simultaneously, or selectively taking a commit from one feature branch to another.
3 / 5
'Git bisect finds the commit that introduced the bug.' How does git bisect work?
git bisect automates binary search through commit history to find which commit introduced a regression. You start bisect, mark the current state as 'bad' and a known good commit as 'good'. Git checks out a midpoint commit; you test and mark it good or bad. Repeat until bisect identifies the exact commit that introduced the bug. For 1,000 commits, it finds the culprit in ~10 steps.
4 / 5
'The reflog is the undo for any git operation.' What does the reflog record?
The reflog (reference log) records every position HEAD has been, including after destructive operations like git reset --hard or git rebase. Even if commits appear 'lost' from the branch, they're in the reflog for 90 days. You can recover them with git checkout or git reset to a reflog entry. The reflog is local and private — it doesn't sync to remote.
5 / 5
'We squash commits before merging to main.' What does squashing commits mean?
Squashing combines multiple commits into one. If a feature branch has 20 commits (including 'WIP', 'fix typo', 'oops revert that') these are collapsed into one clean commit ('Add user authentication feature') before merging to main. This keeps the main branch history readable — each commit represents a complete, meaningful change rather than implementation noise.