Bird
0
0

When should you prefer git rebase over git merge in a collaborative project?

easy📝 Conceptual Q1 of 15
Git - Rebasing
When should you prefer git rebase over git merge in a collaborative project?
ATo delete a branch after merging
BTo combine multiple branches into one without changing history
CTo keep a clean, linear history before merging a feature branch
DTo create a new branch from the current branch
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of git rebase

    Git rebase rewrites commit history to create a linear sequence of commits, which helps keep history clean.
  2. Step 2: Compare with git merge in collaboration

    Git merge preserves all commits and creates a merge commit, which can clutter history. Rebase is preferred before merging to main to avoid this.
  3. Final Answer:

    To keep a clean, linear history before merging a feature branch -> Option C
  4. Quick Check:

    Rebase for clean history = D [OK]
Quick Trick: Use rebase to tidy history before merging [OK]
Common Mistakes:
  • Thinking merge rewrites history
  • Using rebase to delete branches
  • Confusing rebase with branch creation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes