Which statement best describes when you should use git rebase instead of git merge?
Think about how rebase changes the commit history compared to merge.
Rebase moves your branch commits on top of the latest commits from another branch, creating a linear history. This is useful to keep history clean before merging.
In which situation is it better to use git merge instead of git rebase?
Consider which method keeps the full branching history visible.
Merge preserves the full history including all branch points and merge commits, which is useful for understanding how development progressed.
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 checkout feature
<cursor>Rebase moves your commits on top of the latest main branch commits.
Running git rebase main while on your feature branch reapplies your commits on top of the current main branch, updating your branch cleanly.
You ran git rebase main on your feature branch and encountered conflicts. After fixing conflicts, which command should you run to continue the rebase?
Think about the command to resume a rebase after conflict resolution.
After resolving conflicts during a rebase, git rebase --continue tells Git to proceed with applying the remaining commits.
Which practice is recommended when working with branches shared publicly by others?
Consider the impact of rewriting history on others who use the branch.
Rebasing rewrites commit history. Doing this on public branches can confuse collaborators and cause problems. It's safer to merge public branches.