Bird
0
0

Given this pull request review command sequence, what is the output of git diff origin/main..feature-branch?

medium📝 Predict Output Q4 of 15
Git - Collaboration Workflows
Given this pull request review command sequence, what is the output of git diff origin/main..feature-branch?
git fetch origin
# feature-branch is a branch with new commits
AShows differences between main and feature-branch
BShows no differences because branches are identical
CError: branch feature-branch not found
DShows differences between local and remote main
Step-by-Step Solution
Solution:
  1. Step 1: Understand git fetch and diff usage

    After fetching, 'git diff origin/main..feature-branch' compares the remote main branch with the feature branch.
  2. Step 2: Determine expected output

    If feature-branch has new commits, the diff shows changes between main and feature-branch.
  3. Final Answer:

    Shows differences between main and feature-branch -> Option A
  4. Quick Check:

    git diff origin/main..feature-branch = shows differences [OK]
Quick Trick: git diff compares two branches or commits [OK]
Common Mistakes:
  • Assuming no differences if branches exist
  • Expecting error without fetching
  • Confusing local and remote branches

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes