threads / discuss / 16838

'Theirs' merge between branches on a binary file.

Subject: 'Theirs' merge between branches on a binary file.

## tl;dr

9 messages between Dec 22, 2008 and Dec 28, 2008.

replies: 8people: 3as markdown or json

Tim Visher· Dec 22, 2008, 20:56 UTC · lore
Hello Everyone,

I have a binary file that is coming up with a merge conflict (obviously) between two branches and I want to simply say, 'take their version of the file'. Is this possible? In subversion it's a pretty trivial merge operation, so I assume there's something similar in git.

Thanks in advance!
-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
Junio C Hamano· Dec 22, 2008, 21:11 UTC · re: Tim Visher · lore

Re: 'Theirs' merge between branches on a binary file.

"Tim Visher" <tim.visher@gmail.com> writes:
> I have a binary file that is coming up with a merge conflict
> (obviously) between two branches and I want to simply say, 'take their
> version of the file'.

Do you mean during a conflicted merge resolution you would want to check their version out of the index and declare that it is the merge result?

Tim Visher· Dec 22, 2008, 21:16 UTC · re: Junio C Hamano · lore

Re: 'Theirs' merge between branches on a binary file.

On Mon, Dec 22, 2008 at 4:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Do you mean during a conflicted merge resolution you would want to check
> their version out of the index and declare that it is the merge result?
Sure.  Let me try to be a bit clearer.

I was developing on a feature branch and now want to merge back into the master branch. Unfortunately, a binary file somewhat central to the development effort was changed between the the feature branch and the master branch and now there is a conflict. Obviously, I can't fix the conflict via markers or something like that because it's a binary file, and I know that I want the feature branch's version of the file, not the one that it is in conflict with. How would I just select the stage3 version of the file and add that to the index?

-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
Junio C Hamano· Dec 22, 2008, 22:52 UTC · re: Tim Visher · lore

Re: 'Theirs' merge between branches on a binary file.

"Tim Visher" <tim.visher@gmail.com> writes:
Show 6 quoted lines
> On Mon, Dec 22, 2008 at 4:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> Do you mean during a conflicted merge resolution you would want to check
>> their version out of the index and declare that it is the merge result?
>
> Sure.
That sounds like "git checkout --theirs"...
Tim Visher· Dec 22, 2008, 22:58 UTC · re: Junio C Hamano · lore

Re: 'Theirs' merge between branches on a binary file.

On Mon, Dec 22, 2008 at 5:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
> That sounds like "git checkout --theirs"...

I'm sorry, Junio. I don't mean to be dense but I can't find that in the docs and when I execute it it comes back as an unknown command. Perhaps you could just point me to the relevant man page? This seems like such a fundamental operation, I just don't understand why there isn't something like a `git resolve`.

Thanks for your help!
-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
Junio C Hamano· Dec 22, 2008, 23:18 UTC · re: Tim Visher · lore

Re: 'Theirs' merge between branches on a binary file.

"Tim Visher" <tim.visher@gmail.com> writes:
Show 6 quoted lines
> On Mon, Dec 22, 2008 at 5:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> That sounds like "git checkout --theirs"...
>
> I'm sorry, Junio.  I don't mean to be dense but I can't find that in
> the docs and when I execute it it comes back as an unknown command.
Hmph, I meant to point you at:
    http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html

I think you can use "git checkout-index --stage=3 path" if your git is older than that one with the option.

v1.6.0.1-15-g38901a4 (checkout --ours/--theirs: allow checking out one side of a conflicting merge, 2008-08-30) introduced the feature.

Tim Visher· Dec 23, 2008, 14:05 UTC · re: Junio C Hamano · lore

Re: 'Theirs' merge between branches on a binary file.

On Mon, Dec 22, 2008 at 6:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Hmph, I meant to point you at:
>
>    http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html
Ah, yes.  There it is. :)
Show 5 quoted lines
> I think you can use "git checkout-index --stage=3 path" if your git is
> older than that one with the option.
>
> v1.6.0.1-15-g38901a4 (checkout --ours/--theirs: allow checking out one
> side of a conflicting merge, 2008-08-30) introduced the feature.

Apparently this was added, at least to the docs, only in the latest release? That's kind of weird A) because the tag indicates 1.6.0.1, not 0.6, and B) It's a pretty trivial operation in other VCSes. Hmm... Maybe I'll try to updated the docs to make this feature a little more visible.

Anyway, the checkout-index command does indeed work in the older version. That's kind of what I was looking for. I'm now working on compiling git under cygwin as the latest version cygwin installs for you is 0.4!

Thanks for your help!
-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
René Scharfe· Dec 23, 2008, 18:31 UTC · re: Tim Visher · lore

Re: 'Theirs' merge between branches on a binary file.

Tim Visher schrieb:
> I'm now working on
> compiling git under cygwin as the latest version cygwin installs for
> you is 0.4!

Have you seen msysgit (http://code.google.com/p/msysgit/), the easy route to git on Windows? It has all you need to check out and compile the latest version of git.

René
Tim Visher· Dec 28, 2008, 17:14 UTC · re: René Scharfe · lore

Re: 'Theirs' merge between branches on a binary file.

On Tue, Dec 23, 2008 at 1:31 PM, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:

> Have you seen msysgit (http://code.google.com/p/msysgit/), the easy
> route to git on Windows?  It has all you need to check out and compile
> the latest version of git.

I have seen msysgit. I haven't spent too much time with it mainly because I'm in denial that I have to work with Windows all day at work. I'm going to have to look into it I think when I attempt to get my team onto git in a little less than a month.

-- 
In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

← back to recent threads