Merge changes when a file on a branch is split into two files on the main

This is mainly the result of the massive class C on the master, which was reorganized along the line into the two smaller classes C1 and C2. Then C was made a subclass of C2 and cut to the skeletal version for backward compatibility. Thus, from now on, the master contained C, C1, and C2. On this commit git host, the specified C has been renamed to C1. The last update was before that. (All C ++ code if it helps to render files)

Obviously, when I tried to reinstall the branch on master, there were conflicts that needed to be resolved.

As usual, I used mergetool.

So now mergetool offers the following: On the local I have a skeletal version of C. The base and remote control have a number of changes in C.

Since the skeletal version of C exists on Local, I conclude that the changes from Base and Remote should actually go to C1, leaving C alone.

My question is: how do I do this?

+3
source share
1 answer

Maybe on this instance of reinstallation, a more direct resolution of the merge conflict is in order:

    git checkout --ours C
    git show: 1: / path / to / C # check what need to be copied to C1 from Base
    git show: 3: / path / to / C # check what need to be copied to C1 from remote
    git add / path / to / C
    git add / path / to / C1
  • git commit
+4
source

Source: https://habr.com/ru/post/1748062/


All Articles