On Sat, Dec 4, 2021 at 5:20 AM Michael McClimon <michael@xxxxxxxxxxxx> wrote: > > There is a minimal reproducer available at > https://github.com/mmcclimon/git-merge-problem-demo. Fetch all the branches > there. The main branch contains a directory (dir1) with a single file > (file.txt), plus a symlink (dir2), which links to dir1. branch1 replaces this > symlink with a copy of the files that were linked to. (This was accomplished > with: rm dir2; cp -r dir1 dir2.) branch2 and branch3 do not touch this > directory at all. > > Merging these three branches fails: > > $ git merge branch1 branch2 branch3 > Fast-forwarding to: branch1 > Trying simple merge with branch2 > Simple merge did not work, trying automatic merge. > Trying simple merge with branch3 > error: Entry 'dir2/file.txt' not uptodate. Cannot merge. > Merge with strategy octopus failed. > > The order here matters! Here is every permutation (1 here is the symlink > change) to git merge; only the first two fail, all the others work. > > 1 2 3 FAIL > 1 3 2 FAIL > 2 1 3 PASS > 2 3 1 PASS > 3 1 2 PASS > 3 2 1 PASS > 1 2 PASS > 2 1 PASS > 2 3 PASS > 3 2 PASS > 1 3 PASS > 3 1 PASS I'm not a Git contributor (since ~10 years ago) but I was curious and tried your repro myself. Thanks for the very simple instructions. Maybe it's useful to see what the error is when you use the octopus strategy to merge only two commits: ``` $ git checkout origin/branch1 $ git merge -s octopus origin/branch2 Trying really trivial in-index merge... error: Merge requires file-level merging Nope. Merge with strategy octopus failed. ``` That "Merge requires file-level merging" is surprising but maybe the "really trivial" is the explanation :) My *guess* is the answer is that the octopus strategy is really old and should be rewritten using the new "ort" strategy (or maybe be integrated into it). I'm afraid I can't think of a workaround for you (other than trying different permutations until it works).