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:

30 questions
205
votes
3 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
  • 2,775
  • 2
  • 20
  • 18
16
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
  • 90,473
  • 43
  • 204
  • 301
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
  • 156,021
  • 21
  • 318
  • 304
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
  • 6,625
  • 5
  • 42
  • 62
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?
paxos1977
  • 135,245
  • 26
  • 85
  • 125
7
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
7
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,109
  • 4
  • 23
  • 41
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,154
  • 4
  • 30
  • 52
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
  • 17,820
  • 9
  • 50
  • 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
  • 297,146
  • 54
  • 452
  • 522
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,063
  • 6
  • 47
  • 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
  • 2,860
  • 3
  • 22
  • 50
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…
2
votes
1 answer

Implementing a three-way diff/merge

I'm trying to implement a three-way diff/merge algorithm (in python) between, say, the base version X and two different derivative versions A and B, and I'm having trouble figuring out how to handle some changes. I have a line-by-line diff from X to…
brianmearns
  • 8,433
  • 6
  • 49
  • 70
1
2