gitgit-mergegit-plumbing

Plumbing way to do no-fast-forward merge


I'm working on a project that involves using git plumbing methods. I want to implement git no-fast-forward merge (aka three-way merge). I'm not sure which plumbing methods would be suitable for this case

I've already tried using:

it looks promising, but what I got is:

<<<<<<< .merge_file_d4sCZV
This is main branch
=
This is branch 1
>>>>>>>.merge_file_gbJVvh

Of course, conflict looks as it should be, but conflict indicators are a bit strange (In term of merge_file_XXXXX, its not like <<< HEAD etc. Maybe should they be like this, when using lov-level approch?). Is there a more "proper" way to do this using Git plumbing methods? Or is this how it should be?


Solution

  • git merge-one-file is, as the git merge-index docs point out but (strangely) the git merge-one-file docs don't, pretty much a sample script, it's a wrapper around git merge-file which is the core command to do an actual three-way automerge and lets you (but git-merge-one-file doesn't) supply labels for the source files.

    Hunt up the script in libexec/git-core, have your way with it.