78

Why am I given three choices when merging between my code and someone else's? Shouldn't there just be my code, the other person's code, and the output below? The documentation for KDIFF doesn't help me understand.

Mogsdad
  • 40,814
  • 19
  • 140
  • 246
smuggledPancakes
  • 8,687
  • 18
  • 64
  • 104

5 Answers5

75

A refers to the version your merge target is based on. If you Merge from branch to trunk, 'A' will be the previous trunk version.

B is what you currently have in your local trunk folder, including local changes.

C is the Version you wanna merge on top of B.

hobiejeepguy
  • 51
  • 2
  • 7
Th 00 mÄ s
  • 3,641
  • 1
  • 25
  • 43
39

Sounds like you're doing a three-way merge, so A should be the base revision that B and C are based on, B is theirs and C is yours (I believe; B and C might be the opposite, though).

eldarerathis
  • 32,541
  • 9
  • 86
  • 93
  • 2
    What is the base revision about? Does that help in some cases? – smuggledPancakes Oct 25 '10 at 20:55
  • 6
    @user464095: For KDiff I believe that it's the revision that both B and C are modifying. So you can compare B to its base (A), C to its base (also A) and the changes in B and C to each other. That way you can resolve conflicts by using the changes in B or C or by reverting to the original (A). – eldarerathis Oct 25 '10 at 21:04
  • 2
    I still don't understand, can you elaborate some more? – smuggledPancakes Oct 26 '10 at 19:52
  • 13
    Well, consider a case where you and another developer make conflicting changes to the same code. It's typically helpful to have the context of the original file, so you know if either one of you is breaking previous functionality. You could diff your file with the other developer's, resolve conflicts, and then diff it with the original, but a three-way diff performs the same function in fewer steps. – eldarerathis Oct 26 '10 at 20:22
  • As @gbarry explains in [this related SO thread](http://stackoverflow.com/questions/742772/when-does-svn-base-become-equal-to-the-head), the BASE revision is the one you last downloaded from the repository, at least with Subversion. He also talks about editing conflicts and how this effects the BASE and HEAD revisions. – hotshot309 Dec 20 '12 at 14:59
  • This is the first time I've actually understood the reason for a 3-way diff. Thanks! – Clonkex Jun 14 '18 at 00:31
  • @eldarerathis +1 for saying "fewer steps" instead of "less steps" ;) – David Klempfner Nov 27 '19 at 21:45
13

A is your parent revision having B and C as child.
Which means B contains the changes done on A by user1/repo1 and C also contains the changes on A but by other user (user2/repo2)

kdiff gives you the option either to select modification from b or c (or take both) or from parent also 'A'

Sean Van Gorder
  • 3,223
  • 23
  • 25
RollerCosta
  • 4,386
  • 7
  • 47
  • 69
11

A (BASE) ‐‐> Original file that currently sits in remote repo.
B (LOCAL) ‐‐> Your file. This shows only your changes as compared to A.
C (REMOTE) ‐‐> Their file. This shows only their changes as compared to A.

If the changes are on different code lines, you take from both B and C. If the changes are on same code lines (conflict), you take either from B or C.

Nikhil Vartak
  • 4,510
  • 3
  • 21
  • 29
3

If I did git rebase, my observation was that: C - is what in my_branch locally ( i.e. was seen in my editor before the rebase started and conflicts occurred). B - branch I was rebasing my_branch on top of (say master branch for example) A - base revision of B & C (which didn't matter to me too much in this case)

Aleks Tkachenko
  • 584
  • 6
  • 6