CS FundamentalsVery hardProduct-company placement · Git

main and feature split at commit B. Since then main has gained commit C (editing a.txt) and feature has gained commit D (editing b.txt). What does git diff main...feature show?

  1. A. Only D's change to b.txt: the diff from the merge base B to feature
  2. B. Both changes: a.txt reverted and b.txt edited, from main's tip to feature's tip
  3. C. Only C's change to a.txt: the diff from B to main
  4. D. Nothing, because three dots are valid only with git log

Correct answer: A. Only D's change to b.txt: the diff from the merge base B to feature

For git diff, A...B means diff from merge-base(A, B) to B, i.e. what feature introduced. git diff main feature (or main..feature) compares the two tips, which would also show C's change in reverse.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic