Table of Contents
ToggleBranching Basics
1. What command creates a new branch called feature?
A. git checkout feature
B. git branch feature
C. git init feature
D. git merge feature
✅ Answer: B
2. Which command switches to an existing branch dev?
A. git branch dev
B. git merge dev
C. git checkout dev
D. git clone dev
✅ Answer: C
3. What does git checkout -b new-branch do?
A. Deletes a branch
B. Creates and switches to a new branch
C. Merges branches
D. Renames a branch
✅ Answer: B
4. Which command lists all local branches?
A. git status
B. git branch
C. git log
D. git show
✅ Answer: B
5. How do you delete a local branch feature1?
A. git remove feature1
B. git branch -d feature1
C. git checkout -d feature1
D. git merge -d feature1
✅ Answer: B
Merging
6. What does git merge do?
A. Rewrites commit history
B. Combines changes from another branch
C. Deletes commits
D. Resets the repository
✅ Answer: B
7. Which branch receives changes during a merge?
A. The source branch
B. The target (current) branch
C. Both branches
D. The main branch only
✅ Answer: B
8. What is a fast-forward merge?
A. Merge with conflicts
B. Merge that creates a new commit
C. Merge when no divergence exists
D. Merge that deletes history
✅ Answer: C
9. Which command merges feature into the current branch?
A. git merge current feature
B. git merge feature
C. git pull feature
D. git rebase feature
✅ Answer: B
10. What happens if there are merge conflicts?
A. Git aborts automatically
B. Git resolves them automatically
C. User must resolve conflicts manually
D. The merge is skipped
✅ Answer: C
Rebase
11. What does git rebase do?
A. Combines branches with a merge commit
B. Moves commits to a new base
C. Deletes commits
D. Stashes changes
✅ Answer: B
12. Main difference between merge and rebase?
A. Rebase keeps history, merge rewrites it
B. Merge rewrites history, rebase keeps it
C. Rebase rewrites history
D. No difference
✅ Answer: C
13. Which command rebases current branch onto main?
A. git rebase current main
B. git rebase main
C. git merge main
D. git checkout main
✅ Answer: B
14. When should you avoid rebasing?
A. On local branches
B. On shared/public branches
C. On feature branches
D. On new branches
✅ Answer: B
15. What happens to commit hashes after a rebase?
A. They stay the same
B. They are deleted
C. They change
D. They are merged
✅ Answer: C
Conflicts
16. What causes a merge conflict?
A. Same file edited in different branches
B. Different files edited
C. Clean working tree
D. Git version mismatch
✅ Answer: A
17. Which file markers indicate a conflict?
A. @@@
B. ***
C. <<<<<<< ======= >>>>>>>
D. ###
✅ Answer: C
18. How do you mark a conflict as resolved?
A. git commit only
B. git add the resolved file
C. git reset
D. git stash
✅ Answer: B
19. Which command aborts a merge?
A. git reset --hard
B. git merge --abort
C. git checkout .
D. git rebase --continue
✅ Answer: B
20. Which command continues a rebase after conflict resolution?
A. git rebase --abort
B. git rebase --continue
C. git merge --continue
D. git commit
✅ Answer: B
Advanced Branching
21. What is HEAD in Git?
A. Last commit
B. Current branch pointer
C. Remote branch
D. Tag
✅ Answer: B
22. Which command renames the current branch?
A. git branch -r
B. git branch -m new-name
C. git checkout -m
D. git merge -m
✅ Answer: B
23. What does git branch -a show?
A. Only local branches
B. Only remote branches
C. Local and remote branches
D. Tags only
✅ Answer: C
24. Which branch is usually considered stable?
A. feature
B. dev
C. main/master
D. test
✅ Answer: C
25. What is a detached HEAD state?
A. HEAD pointing to a commit instead of a branch
B. Deleted branch
C. Corrupted repo
D. Untracked files
✅ Answer: A
Merge vs Rebase Scenarios
26. Which keeps commit history linear?
A. Merge
B. Rebase
C. Pull
D. Fetch
✅ Answer: B
27. Which creates a merge commit?
A. Rebase
B. Checkout
C. Merge
D. Reset
✅ Answer: C
28. Best option for a clean project history?
A. Merge always
B. Rebase feature branches
C. Avoid branches
D. Use reset
✅ Answer: B
29. Which is safer for shared branches?
A. Rebase
B. Reset
C. Merge
D. Cherry-pick
✅ Answer: C
30. Git pull is equivalent to?
A. fetch + merge
B. fetch + rebase
C. merge + commit
D. rebase + reset
✅ Answer: A
Conflict Handling
31. Which tool helps visualize conflicts?
A. git log
B. git diff
C. git blame
D. git show
✅ Answer: B
32. What does git checkout --theirs file.txt do?
A. Keeps your changes
B. Keeps incoming changes
C. Deletes file
D. Aborts merge
✅ Answer: B
33. What does git checkout --ours file.txt do?
A. Keeps current branch changes
B. Keeps remote changes
C. Removes file
D. Stashes file
✅ Answer: A
34. After resolving conflicts, what’s the final step?
A. git push
B. git add + git commit
C. git reset
D. git fetch
✅ Answer: B
35. What happens if conflicts aren’t resolved?
A. Git ignores them
B. Git auto-fixes later
C. Merge/rebase cannot complete
D. Repo is deleted
✅ Answer: C
Practical Git Knowledge
36. What command shows branch history graphically?
A. git status
B. git log --oneline --graph
C. git branch -v
D. git show
✅ Answer: B
37. Which command applies a commit from another branch?
A. merge
B. rebase
C. cherry-pick
D. reset
✅ Answer: C
38. Which is NOT a merge strategy?
A. recursive
B. ours
C. theirs
D. stash
✅ Answer: D
39. Which command cancels a rebase?
A. git rebase --abort
B. git merge --abort
C. git reset --soft
D. git checkout main
✅ Answer: A
40. What is a conflict-free merge called?
A. clean merge
B. soft merge
C. fast-forward merge
D. silent merge
✅ Answer: C
Final Git Concepts
41. Which file often causes conflicts?
A. README
B. package-lock.json
C. .gitignore
D. LICENSE
✅ Answer: B
42. Which command checks current branch?
A. git status
B. git branch
C. git log
D. git diff
✅ Answer: A
43. What does rebasing improve?
A. Performance
B. History readability
C. Security
D. Storage
✅ Answer: B
44. Which command merges without fast-forward?
A. git merge --no-ff
B. git merge --fast
C. git rebase --no-ff
D. git pull --no-ff
✅ Answer: A
45. What is a common Git workflow?
A. Feature → main
B. Feature → dev → main
C. Main → feature
D. No branches
✅ Answer: B
46. What does git fetch do?
A. Updates local branches
B. Downloads remote changes without merging
C. Deletes remote branches
D. Pushes commits
✅ Answer: B
47. Which command pushes a new branch to remote?
A. git push
B. git push origin branch-name
C. git upload
D. git send
✅ Answer: B
48. What happens if you rebase main onto feature?
A. Feature history changes
B. Main history changes
C. Both histories deleted
D. Nothing
✅ Answer: B
49. Which Git operation is irreversible without backup?
A. merge
B. rebase (after push)
C. checkout
D. fetch
✅ Answer: B
50. Best practice before merging?
A. Force push
B. Rebase main onto feature
C. Run tests & review code
D. Delete branch
✅ Answer: C
Conclusion
Mastering Git branching, merging, rebasing, and conflict resolution is essential for any developer or DevOps engineer working in collaborative environments. This quiz was designed to test both theoretical knowledge and practical understanding of real-world Git workflows.
If you scored high, great job you’re clearly comfortable navigating complex version control scenarios. If some questions felt tricky, don’t worry. Git is a skill that improves with daily use, code reviews, and hands-on practice. Revisit the concepts you missed, experiment in a safe repository, and keep refining your workflow.
Whether you’re preparing for interviews, working on team projects, or aiming to follow DevOps best practices, a strong command of Git will always give you an edge. Keep practicing, keep experimenting, and most importantly don’t be afraid of conflicts… Git ones
Happy coding and versioning!
- For more information about Git you can refer to Jeevi’s Page.
- This tutorial is just the beginning learn DevOps hands-on in our complete course. Upgrade your skills.



