How merges actually wire conflicts into the index.
git merge-index walks unmerged entries in the index and runs a merge program for each, letting you script how stage 1/2/3 entries get reconciled. It's the dispatcher under git merge.
After a merge attempt, the index holds up to three stages per conflicted path. merge-index feeds those stages plus the path to a per-file merge driver and updates the index based on its result.
git merge-index [-o] [-q] <merge-program> (-a | [--] <file>...)
git merge-index [-o] [-q] <merge-program> --stdin [-z]| Flag | What it does |
|---|---|
<merge-program> | Program to invoke per file; gets stages and path as arguments. |
-a / --all | Run the merge program for every unmerged entry in the index. |
-q / --quiet | Don't complain when the merge program exits non-zero. |
-o / --one-shot | Continue past failures and report at the end instead of stopping on first error. |
--stdin | Read paths to merge from stdin instead of arguments. |
-z | With --stdin, expect NUL-terminated paths. |
git read-tree -m 3-way read.git merge-one-file (or your own driver) across many conflicted paths.git merge-index -o git-merge-one-file -agit merge-index ./my-driver.sh -- path/to/conflictedgit diff --name-only -z --diff-filter=U | git merge-index -o git-merge-one-file --stdin -zgit merge-index -q -o git-merge-one-file -agit merge-one-file as the standard driver unless you have a strong reason to roll your own.git ls-files -u output for full control over what gets retried.cat-file them itself.read-tree -m first to populate stages.Hit each option, then Check answers. Score is recorded; Next is always open.