Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: fatal: '--ours/--theirs' cannot be used with switching branches

Tags:

git

git-merge

In a merge conflict, I'm trying to resolve all the merge conflicts in favour of a particular branch.

I'm trying to do git checkout --ours, but I get the following error:

fatal: '--ours/--theirs' cannot be used with switching branches

How can I achieve what I'm trying to do?

like image 690
Tom Hale Avatar asked Sep 01 '25 20:09

Tom Hale


1 Answers

Using git checkout with --ours or --theirs expects at least one argument: the path(s) of the files / directories to checkout.

As the manual says:

When checking out paths from the index, check out stage #2 (ours) or #3 (theirs) for unmerged paths.

So:

git checkout --ours <path(s)>
like image 152
Tom Hale Avatar answered Sep 04 '25 13:09

Tom Hale