git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Merging a branch when I don't want conflicts
@ 2009-05-18  2:30 Geoff Russell
  2009-05-18  6:18 ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Geoff Russell @ 2009-05-18  2:30 UTC (permalink / raw)
  To: git

How do I merge a branch X into my master and tell git that whenever there
is a conflict, the file on X should prevail?  This is for a scripted
application.

Cheers,
Geoff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18  2:30 Merging a branch when I don't want conflicts Geoff Russell
@ 2009-05-18  6:18 ` Johannes Sixt
  2009-05-18  8:05   ` Geoff Russell
  2009-05-18 10:45   ` Nanako Shiraishi
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Sixt @ 2009-05-18  6:18 UTC (permalink / raw)
  To: geoffrey.russell; +Cc: git

Geoff Russell schrieb:
> How do I merge a branch X into my master and tell git that whenever there
> is a conflict, the file on X should prevail?  This is for a scripted
> application.

I assume you talk about file-level (content) merges.

There is no such tool, and the reason is that what you try to do here does
not make sense *in general*. It must be a very special kind of project
where you can blindly trust one side over the other if there are
conflicts, and that you can additionally trust non-conflicting content merges.

The best you can do is perhaps to pipe conflicting files through

    sed -e '/^<<<<<<</,/^=======/d' -e '/^>>>>>>>/d'

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18  6:18 ` Johannes Sixt
@ 2009-05-18  8:05   ` Geoff Russell
  2009-05-18  9:01     ` Johannes Sixt
  2009-05-18 10:45   ` Nanako Shiraishi
  1 sibling, 1 reply; 8+ messages in thread
From: Geoff Russell @ 2009-05-18  8:05 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

On 5/18/09, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Geoff Russell schrieb:
>
> > How do I merge a branch X into my master and tell git that whenever there
>  > is a conflict, the file on X should prevail?  This is for a scripted
>  > application.
>
>
> I assume you talk about file-level (content) merges.

Yes.

>
>  There is no such tool, and the reason is that what you try to do here does
>  not make sense *in general*. It must be a very special kind of project
>  where you can blindly trust one side over the other if there are
>  conflicts, and that you can additionally trust non-conflicting content merges.

The file is data coming out of an interactive program which reads
the entire file, edits and then writes the entire file at which point
this file is correct
and all previous versions are obsolete.  I don't really want a merge
at all, but just
want to replace the file in the master with the version on the branch.

Thanks anyway.

Cheers,
Geoff.

>
>  The best you can do is perhaps to pipe conflicting files through
>
>     sed -e '/^<<<<<<</,/^=======/d' -e '/^>>>>>>>/d'
>
>  -- Hannes
>
>


-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18  8:05   ` Geoff Russell
@ 2009-05-18  9:01     ` Johannes Sixt
  2009-05-18 23:53       ` Geoff Russell
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2009-05-18  9:01 UTC (permalink / raw)
  To: geoffrey.russell; +Cc: git

Geoff Russell schrieb:
> The file is data coming out of an interactive program which reads
> the entire file, edits and then writes the entire file at which point
> this file is correct
> and all previous versions are obsolete.  I don't really want a merge
> at all, but just
> want to replace the file in the master with the version on the branch.

Ah, so finally you say what you mean ;)

You can define a custom merge driver that always returns the content of
the second branch. See 'man gitattributes'.

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18  6:18 ` Johannes Sixt
  2009-05-18  8:05   ` Geoff Russell
@ 2009-05-18 10:45   ` Nanako Shiraishi
  2009-05-18 15:57     ` Tay Ray Chuan
  1 sibling, 1 reply; 8+ messages in thread
From: Nanako Shiraishi @ 2009-05-18 10:45 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: geoffrey.russell, git

Quoting Johannes Sixt <j.sixt@viscovery.net>:

> Geoff Russell schrieb:
>> How do I merge a branch X into my master and tell git that whenever there
>> is a conflict, the file on X should prevail?  This is for a scripted
>> application.
>
> I assume you talk about file-level (content) merges.
>
> There is no such tool, and the reason is that what you try to do here does
> not make sense *in general*. It must be a very special kind of project
> where you can blindly trust one side over the other if there are
> conflicts, and that you can additionally trust non-conflicting content merges.
>
> The best you can do is perhaps to pipe conflicting files through
>
>     sed -e '/^<<<<<<</,/^=======/d' -e '/^>>>>>>>/d'
>
> -- Hannes

I think -Xours enhancement that was developed long time ago

    http://thread.gmane.org/gmane.comp.version-control.git/76650/focus=89021

should help Geoff's use case.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18 10:45   ` Nanako Shiraishi
@ 2009-05-18 15:57     ` Tay Ray Chuan
  2009-05-18 16:17       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Tay Ray Chuan @ 2009-05-18 15:57 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Johannes Sixt, geoffrey.russell, git

Hi,

On Mon, May 18, 2009 at 6:45 PM, Nanako Shiraishi <nanako3@lavabit.com> wrote:
> I think -Xours enhancement that was developed long time ago

I think this is now called -s ours/--strategy=ours:

http://www.kernel.org/pub/software/scm/git/docs/git-merge.html

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18 15:57     ` Tay Ray Chuan
@ 2009-05-18 16:17       ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-05-18 16:17 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: Nanako Shiraishi, Johannes Sixt, geoffrey.russell, git

Tay Ray Chuan <rctay89@gmail.com> writes:

> Hi,
>
> On Mon, May 18, 2009 at 6:45 PM, Nanako Shiraishi <nanako3@lavabit.com> wrote:
>> I think -Xours enhancement that was developed long time ago
>
> I think this is now called -s ours/--strategy=ours:
>
> http://www.kernel.org/pub/software/scm/git/docs/git-merge.html

Read it again.  -Xours is very different from -s ours.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Merging a branch when I don't want conflicts
  2009-05-18  9:01     ` Johannes Sixt
@ 2009-05-18 23:53       ` Geoff Russell
  0 siblings, 0 replies; 8+ messages in thread
From: Geoff Russell @ 2009-05-18 23:53 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Tay Ray Chuan, Nanako Shiraishi, git

On Mon, May 18, 2009 at 6:31 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Geoff Russell schrieb:
>> The file is data coming out of an interactive program which reads
>> the entire file, edits and then writes the entire file at which point
>> this file is correct
>> and all previous versions are obsolete.  I don't really want a merge
>> at all, but just
>> want to replace the file in the master with the version on the branch.
>
> Ah, so finally you say what you mean ;)
>
> You can define a custom merge driver that always returns the content of
> the second branch. See 'man gitattributes'.
>
> -- Hannes
>

Sorry for the confusion. A custom merge driver will work fine ... but I
will also rethink carefully  what I am doing.

Cheers,
Geoff.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-18 23:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18  2:30 Merging a branch when I don't want conflicts Geoff Russell
2009-05-18  6:18 ` Johannes Sixt
2009-05-18  8:05   ` Geoff Russell
2009-05-18  9:01     ` Johannes Sixt
2009-05-18 23:53       ` Geoff Russell
2009-05-18 10:45   ` Nanako Shiraishi
2009-05-18 15:57     ` Tay Ray Chuan
2009-05-18 16:17       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).