0
0
Gitdevops~20 mins

When to rebase vs when to merge in Git - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Rebase vs Merge Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Rebase vs Merge Purpose

Which statement best describes when you should use git rebase instead of git merge?

AUse rebase to permanently delete commits from the repository history.
BUse rebase to combine multiple commits into one without changing the commit history.
CUse rebase to create a new branch from an existing branch without merging changes.
DUse rebase to keep a clean, linear history by moving your changes on top of the latest main branch commits.
Attempts:
2 left
💡 Hint

Think about how rebase changes the commit history compared to merge.

🧠 Conceptual
intermediate
2:00remaining
When to Prefer Merge Over Rebase

In which situation is it better to use git merge instead of git rebase?

AWhen you want to preserve the exact history of how branches diverged and merged, showing all merge commits.
BWhen you want to rewrite commit messages before integrating changes.
CWhen you want to delete a branch after integrating its changes.
DWhen you want to squash all commits into one before merging.
Attempts:
2 left
💡 Hint

Consider which method keeps the full branching history visible.

🔀 Workflow
advanced
2:00remaining
Choosing Rebase or Merge in a Team Workflow

Your team uses a shared main branch. You have a feature branch that you want to update with the latest main changes before merging. Which command sequence correctly updates your feature branch using rebase?

Git
git checkout feature
<cursor>
Agit fetch origin && git merge origin/main
Bgit merge main
Cgit rebase main
Dgit pull origin main
Attempts:
2 left
💡 Hint

Rebase moves your commits on top of the latest main branch commits.

Troubleshoot
advanced
2:00remaining
Resolving Conflicts During Rebase vs Merge

You ran git rebase main on your feature branch and encountered conflicts. After fixing conflicts, which command should you run to continue the rebase?

Agit rebase --continue
Bgit merge --continue
Cgit commit -m 'fix conflicts'
Dgit rebase --abort
Attempts:
2 left
💡 Hint

Think about the command to resume a rebase after conflict resolution.

Best Practice
expert
3:00remaining
Best Practice for Public Branches

Which practice is recommended when working with branches shared publicly by others?

AAlways rebase public branches to keep history clean.
BAvoid rebasing public branches to prevent rewriting shared history.
CDelete public branches frequently to reduce clutter.
DForce push after rebasing public branches to update everyone.
Attempts:
2 left
💡 Hint

Consider the impact of rewriting history on others who use the branch.