Branching — Create, Switch, Merge — Concept Check
Questions on Branching — Create, Switch, Merge. Branches are free in Git — creating one takes microseconds. They let you isolate work (features, fixes, experiments) from the main codebase and merge back when ready.
Questions in this quiz
8 questions on Branching — Create, Switch, Merge — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You are working on a feature branch and want to merge it into main. The main branch has not moved since you branched off. What type of merge will Git perform?
- AThree-way merge
- BRebase
- CFast-forward merge
- DSquash merge
2.A developer creates a branch named 'feature/payment-gateway' and works on it for a month without merging. What issue might they encounter?
- AGit won't allow merging
- BBranch deletion
- CFast-forward merge
- DIntegration hell
3.You attempt to delete a branch using 'git branch -d feature/payment-gateway' but it fails. Why might this happen?
- AGit is outdated
- BUnmerged work exists
- CBranch name is incorrect
- DBranch is already deleted
4.What happens if you try to switch to a branch that doesn't exist using 'git switch'?
- AGit throws an error
- BGit merges changes
- CGit switches to main
- DGit creates a new branch
5.A merge conflict arises when merging two branches. What should you do first?
- AAbort the merge
- BEdit the file to resolve conflicts
- CForce merge with '-D'
- DDelete the conflicting branch
6.A developer believes that Git branches are costly in terms of storage. What is the truth about Git branches?
- AGit branches consume significant storage
- BGit branches slow down operations
- CGit branches are lightweight
- DGit branches require manual cleanup
7.While working on a feature branch, you notice the main branch has new commits. What merge strategy will Git use when you merge?
- AFast-forward merge
- BSquash merge
- CRebase
- DThree-way merge
8.Why should branch names in Git use kebab-case and descriptive prefixes like 'feature/' or 'fix/'?
- ATo prevent merge conflicts
- BTo speed up branch creation
- CFor clarity and organization
- DTo enable fast-forward merges