CS FundamentalsVery hardProduct-company placement · Git interview

While running git rebase main on your feature branch, a conflict appears. In this situation, what do git checkout --ours and --theirs refer to?

  1. A. --ours is the main side (the base being rebased onto) and --theirs is your feature commit being replayed
  2. B. --ours is always your feature branch and --theirs is main, as in a merge
  3. C. Both refer to the common ancestor
  4. D. --ours is the remote and --theirs is the local branch

Correct answer: A. --ours is the main side (the base being rebased onto) and --theirs is your feature commit being replayed

A rebase replays your commits onto main, so HEAD is the rebuilt main-based history ('ours') and the commit being applied is 'theirs'. This is the reverse of what people expect from git merge on their own branch.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic