Search code examples
kdiff3

Copy single difference in kdiff3


Is it possible to copy only one change or many changes one by one in kdiff? There are such options in WinMerge which allow to copy chnge from one file to second file without merging.

I need to copy few changes from one file to another and want to do it manually.


Solution

  • first of all, say we have a left.txt and a right.txt, you need to make sure that right.txt is placed on the right side of kdiff.

    so it will be like this:

           left.txt       right.txt
    1        a              b
    2        b              b
    3        c              b
    

    say you only want the 3rd line in left.txt to be merged in right.txt

    FIRST, align and split/join the diff to satisfy your needs.

    You can find it in the help document, search:

    Manually Aligning Lines and Manually Joining and Splitting Diff Sections

    Here comes the process

    1, click 'merge' on the toolbar

    2, use ctrl+shift+2 to apply all conflicts with right.txt(which is also B here)

    the merge file will become:

    1    b
    2    b
    3    b
    

    3, select line 3, press ctrl+1 that will select changes from left.txt. And the output file wlll be:

    1    b
    2    b
    3    c
    

    And I think that is what you want.