Questions tagged [three-way-merge]

A three-way merge is a merge between a base version of a file and two diverged versions. Three-way merges are the corner-stone of automatic merges in modern version control systems.

More information:

28 questions
254
votes
4 answers

Why is a 3-way merge advantageous over a 2-way merge?

Wikipedia says a 3-way merge is less error-prone than a 2-way merge, and often times doesn't need user intervention. Why is this the case? An example where a 3-way merge succeeds and a 2-way merge fails would be helpful.
Johannes Bittner
  • 3,503
  • 2
  • 23
  • 21
18
votes
8 answers

Subversion: How to merge only specific revisions into trunk when multiple consecutive changes are made in a branch?

I have been using TortoiseSVN, svn, and subclipse and I think I understand the basics, but there's one thing that's been bugging me for a while: Merging introduces unwanted code. Here's the steps. trunk/test.txt@r2. A test file was created with 'A'…
Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
15
votes
2 answers

Why are Mercurial backouts in one branch affecting other branches?

This is a difficult situation to explain, so bear with me. I have a Mercurial repository with 2 main branches, default and dev. Work is usually done in a named branch off of dev (a feature branch). There may be many feature branches at any one time.…
James Allardice
  • 164,175
  • 21
  • 332
  • 312
11
votes
0 answers

Controlling manual alignment in 'Beyond Compare's 3-way merge

When doing a 3-way merge in 'Beyond Compare', we can get the following misalignment due to code similarity (The X's are the deleted code segments, and only two files are shown): /* XXXXXXXXXXXXXXXXX somefunc() …
Basel Shishani
  • 7,735
  • 6
  • 50
  • 67
10
votes
5 answers

How can I use Beyond Compare 3 as the diff3-cmd for svn?

I saw this posting which explained how to get BC3 working as the diff tool for Subversion... but what about using Beyond Compare 3 to do 3-way merge/compares?
oz10
  • 153,307
  • 27
  • 93
  • 128
8
votes
2 answers

non-graphical 3-way merge tool

I currently use RCS' merge command to do 3-way merges, but one thing has always annoyed me about it. If I use the -A option, the same change made in both files shows up as a conflict: <<<<<<< file1 file1 line 1 ||||||| orig orig line 1 ======= file2…
David
8
votes
3 answers

3-way merge in JavaScript or PHP

Does anyone know of an Open Source three-way merge implementation in JavaScript or PHP? I want to merge plain text files without the need to rely on any server side binaries. I found a few solutions for creating diffs, but no merge implementations.
Andreas Gohr
  • 4,617
  • 5
  • 28
  • 45
6
votes
3 answers

How do I specify a merge-base to use in a 'hg merge'

I'm trying to do a complicated merge in a complicated hg repository. I'm not happy with the "newest shared ancestor" that Mercurial chooses to use as the "base" to perform the merge. I'd like to specify a specific commit of my own choice to use as…
Lucas Meijer
  • 4,424
  • 6
  • 36
  • 53
5
votes
5 answers

Tool for 3-Way Binary (Hex) File Comparison?

I have a set of binary configuration files with three versions each -- an original, and two differently-modified versions of each file. I need to be able to see the differences between the two versions as well as the original, all at the same…
Brian Lacy
  • 18,785
  • 10
  • 55
  • 73
5
votes
4 answers

Three-way-merge - different philosophies?

I've been a user of UltraCompare Pro since it first came out, and I think it's a very full-featured compare and merge tool. However, since I have been looking more closely into DVCS, I found that it handles three-way merges differently than (most?)…
Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561
4
votes
1 answer

Handling [re]moved lines with Meld visual diff and merge tool

I have a question about the Meld visual diff and merge tool, which is probably a simple misunderstanding. But how do I adopt lines that were removed in the $REMOTE? Please see the screenshot below for an example. I have changed the order of the…
jeverling
  • 2,004
  • 1
  • 20
  • 21
4
votes
5 answers

Best practice tools and techniques for merging a derived code snapshot with updated upstream code?

The situation is as follows: it is necessary to merge in changes from an upstream code base (from V1, to V2), into a third code base S1 that is derived/branched from V1, to produce a new code base S2. We have access to version control for logs and…
grrussel
  • 7,209
  • 8
  • 51
  • 71
3
votes
3 answers

Why does a merge need you to consider the common ancestor?

I'm learning Git, and am finding the tutorial on this site very useful. On that page, concerning merging, it includes: +---------- (D) ---------------+ / | \ (A) -- (B) -- (C) -------------- (E) --…
user146043
3
votes
2 answers

Three way dictionary deep merge in python

I would like to merge two dictionaries A and B, knowing a common previous state C of both dictionaries. I need the merge to occur in subdictionaries too. In the case of real conflict, I need an exception to be raised. 1 - In the following example,…
azmeuk
  • 4,026
  • 3
  • 37
  • 64
2
votes
2 answers

Resolving Merge Conflict in IDE Whilst Retaining 3-Way Merge Info

(I am using SourceTree as my Git tool, Beyond Compare to resolve merge conflicts, and Eclipse as my Java IDE.) The conflict is complex enough that I cannot solve it in the merge tool, and will have to resolve it manually (across multiple…
1
2