I have two branches A and B. What I want to do is create a new (merge) commit in with the current state A as the parent, which refers to the file tree described by B, discarding anything from A. Basically story B should be compressed into one commit.
The specific state of the repository consists of two independent branches that do not have a common ancestor (of two previously independent repositories), but describe the same content. Now I want to find "git" - a way to combine them. The main solution (without git) would be to check A and just copy the contents of B to the working tree and make a git commit . This is basically what I did earlier to distribute the contents of the second repository to the first.
To do this with git, I tried
git checkout A git merge
But, fortunately, it caused merge conflicts for all files that differ between A and B, which is definitely not what I expected.
Basically something like
git merge
must complete the task, but theirs merge theirs does not exist. Reading documents the ability to use something like
git merge -X theirs
which is a recursive merger strategy option. But this still makes the merging of conflict-free pieces. Only conflicting pieces are taken directly from theirs .
source share