From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <sbeller@google•com>
Cc: Phil Susi <phillsusi@gmail•com>,
"git\@vger.kernel.org" <git@vger•kernel.org>
Subject: Re: git checkout --theirs fails
Date: Tue, 15 Mar 2016 14:47:40 -0700 [thread overview]
Message-ID: <xmqqd1qv76rn.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kbzrpHowSLfCjB6wVfeX_3MUXAjD0rQdcugryWPMrTazQ@mail.gmail.com> (Stefan Beller's message of "Tue, 15 Mar 2016 14:35:18 -0700")
Stefan Beller <sbeller@google•com> writes:
> On Tue, Mar 15, 2016 at 10:27 AM, Phil Susi <phillsusi@gmail•com> wrote:
>> I'm doing a rebase and got some conflicts. I just want to take their
>> version of all files, but git checkout --theirs complains:
>>
>> --ours/--theirs' cannot be used with switching branches
>>
>> What gives? I'm not *trying* to switch branches. I just want to
>> resolve the conflict by taking their version. If I try git checkout
>> --theirs ., then it complains that not every single file in the
>> directory has a "their" version. So? Take the ones that do.
>
> I think for checking out files you'd need to add the file names.
> In case of a collision between branch name and file name, even add
> a double dash:
>
> git checkout --theirs -- file/name
That is true, but notice that the last example by Phil gives a dot
as the pathspec to match all available files.
Having said that,
$ git checkout --theirs -- file/name
would fail when the path file/name is unmerged and does not have
stage #3 entry, wouldn't it? So with ".", unless all paths that
match that pathspec (i.e. all available files) are either merged
(i.e. without conflict) or have stage #3 entry, it is expected that
the command would fail consistently to the case where a pathspec
"file/name" that happens to match only one path is given, and that
is the behaviour Phil saw, I would think.
next prev parent reply other threads:[~2016-03-15 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 17:27 git checkout --theirs fails Phil Susi
2016-03-15 21:35 ` Stefan Beller
2016-03-15 21:47 ` Junio C Hamano [this message]
2016-03-16 12:45 ` Phil Susi
2016-03-16 21:12 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd1qv76rn.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=phillsusi@gmail$(echo .)com \
--cc=sbeller@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox