Search code examples
gitcommand-linediffthree-way-merge

Standalone merging / 3-way equivalent of git diff --no-index


We can use git's diff tool without git repos with git diff --no-index <FILE-A> <FILE-B>.

Is there a similar command for running git's merge algorithm given three input files ("ours", base & "theirs")? And specifically it should output the "diff3" style (seeing the "base" in the conflict is essential)

I understand that it couldn't be as smart as git's recursive merge strategy but I would be very satisfied with something basic like the "resolve" strategy.


Solution

  • git merge-file -p --diff3 ours base theirs