Bird
0
0

You have a conflict in README.md. You run:

medium📝 Command Output Q5 of 15
Git - Cherry-Pick and Advanced Merging
You have a conflict in README.md. You run:
git checkout --ours README.md
Then git add README.md. What does this do?
ALeaves the conflict unresolved
BKeeps the current branch version and marks conflict resolved
CDeletes the file and stages deletion
DKeeps the incoming branch version and marks conflict resolved
Step-by-Step Solution
Solution:
  1. Step 1: Checkout 'ours' version

    This replaces the conflicted file with your current branch's version.
  2. Step 2: Stage the file with git add

    Adding the file tells Git the conflict is resolved using the chosen version.
  3. Final Answer:

    Keeps the current branch version and marks conflict resolved -> Option B
  4. Quick Check:

    Checkout ours + git add = keep current branch, resolve conflict [OK]
Quick Trick: Checkout ours then add resolves conflict with current branch version [OK]
Common Mistakes:
  • Assuming it keeps incoming branch version
  • Thinking it deletes the file
  • Forgetting to add after checkout

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes