How Do I Keep and Discard Individual Lines When Doing Three-Way Merge

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EasyGoingPat
    Journeyman
    • Mar 2018
    • 10

    How Do I Keep and Discard Individual Lines When Doing Three-Way Merge

    I am using Git as my source control system. I use SourceTree as a GUI to help with this. SourceTree allows external diff tools to be launched when there is a merge conflict. I have configured it to use Beyond Compare 4 and this launches fine, with the correct three versions of the file displayed in the three panes at the stop of the screen.

    My question is a very simple one and I can't help but feel it must have been answered already but I can't find it.

    How do I have line-by-line control over which lines I take and discard from the left and right files?

    I can resort to full edit but doing this, I end up literally retyping the lines displayed above because I can't figure out how to copy a line from the panes above.

    Related to the above question is the problem of alignment. If I keep a line from the left file and then one from the right file, clearly my target files in the lower pane now has an extra line to the files I started with. is there a way to 'line-up' the compare again?

    Any help or pointers to information would be very much appreciated.

    Kind wishes ~ Patrick
  • Aaron
    Team Scooter
    • Oct 2007
    • 15995

    #2
    Hello,

    A few quick methods:

    1) click into the gutter to select a single line in one of the top input panes, and the gutter selection for a single pane then copies just the one (or multiple) lines.

    2) Session menu -> Session Settings, Alignment tab: A merge conflict is Left change and right change separated by lines, which will link between Conflict sections, but can be reduced to 1 or "only different change lines"

    3) Tools menu -> File Formats, and select/edit or new Text format, and under the Misc tab you can set "Lines as Independent" so every line is individually handled.

    With the Take Left then Right command, it will attempt to auto-align, but you can also right click -> Align With on one line, and then select a target line to manually push the alignment around.

    Do any of these methods work best for you?
    Aaron P Scooter Software

    Comment

    • EasyGoingPat
      Journeyman
      • Mar 2018
      • 10

      #3
      Originally posted by Aaron
      Hello,

      A few quick methods:

      1) click into the gutter to select a single line in one of the top input panes, and the gutter selection for a single pane then copies just the one (or multiple) lines.

      2) Session menu -> Session Settings, Alignment tab: A merge conflict is Left change and right change separated by lines, which will link between Conflict sections, but can be reduced to 1 or "only different change lines"

      3) Tools menu -> File Formats, and select/edit or new Text format, and under the Misc tab you can set "Lines as Independent" so every line is individually handled.

      With the Take Left then Right command, it will attempt to auto-align, but you can also right click -> Align With on one line, and then select a target line to manually push the alignment around.

      Do any of these methods work best for you?
      Method #1 seems easiest. I'm being a bit thick with the manual alignment, though. Don't seem to be able to get it to do what I want it to do. I think I am probably just not reading the differences display properly.

      Thank you for your help.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15995

        #4
        The manual alignment command in the Text Merge works by selecting a single line in an input (top) pane, right-click -> Align With, and then clicking on a specific line in another input pane. This then aligns that pairing instead of the default/algorithm's alignment, which alters the bottom Output pane.
        Aaron P Scooter Software

        Comment

        Working...