Which Git merge strategy creates a new commit when fast-forward is not possible?
Think about the default strategy Git uses for two-parent merges that preserves history.
The recursive strategy is the default for merging two branches and creates a merge commit when a fast-forward is not possible. Other strategies behave differently.
What is the output of the following Git command sequence?
git checkout main git merge feature-branch
Assuming main is behind feature-branch and no conflicts exist.
Consider what happens when the current branch can be moved forward without creating a merge commit.
A fast-forward merge moves the branch pointer forward without a merge commit, showing 'Fast-forward' in the output.
Which Git configuration command sets the default merge strategy to ours for all merges?
Look for the correct Git config key for setting the merge strategy.
The correct key to set the default merge strategy is merge.strategy. Setting it to ours makes Git use that strategy by default.
You attempt to merge three branches at once using the octopus strategy but get an error. What is the most likely cause?
Octopus merges multiple branches but has limitations.
The octopus strategy can merge multiple branches but fails if there are conflicts. It does not handle conflicts well.
You have a long-running feature branch and want to keep its history linear on the main branch but still incorporate upstream changes regularly. Which Git merge strategy and workflow combination best fits this need?
Think about keeping a clean, linear history while incorporating upstream changes.
Rebasing the feature branch onto main regularly keeps history linear and up to date. Then merging with fast-forward avoids extra merge commits.