{
    "content": [
        {
            "type": "text",
            "text": "# git-merge-index(1) (man)\n\n**Summary:** git-merge-index - Run a merge for files needing merging\n\n**Synopsis:** git merge-index [-o] [-q] <merge-program> (-a | [--] <file>*)\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -a | — | — | Run merge against all files in the index that need merging. |\n| -o | — | — | Instead of stopping at the first failed merge, do all of them in one shot - continue with merging even when previous mer |\n| -q | — | — | Do not complain about a failed merge program (a merge program failure usually indicates conflicts during the merge). Thi |\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (3 lines)\n- **DESCRIPTION** (4 lines)\n- **OPTIONS** (3 lines) — 3 subsections\n  - -a (2 lines)\n  - -o (4 lines)\n  - -q (39 lines)\n- **GIT** (5 lines)\n\n## Full Content\n\n### NAME\n\ngit-merge-index - Run a merge for files needing merging\n\n### SYNOPSIS\n\ngit merge-index [-o] [-q] <merge-program> (-a | [--] <file>*)\n\n### DESCRIPTION\n\nThis looks up the <file>(s) in the index and, if there are any merge entries, passes the\nSHA-1 hash for those files as arguments 1, 2, 3 (empty argument if no file), and <file> as\nargument 4. File modes for the three files are passed as arguments 5, 6 and 7.\n\n### OPTIONS\n\n--\nDo not interpret any more arguments as options.\n\n#### -a\n\nRun merge against all files in the index that need merging.\n\n#### -o\n\nInstead of stopping at the first failed merge, do all of them in one shot - continue with\nmerging even when previous merges returned errors, and only return the error code after\nall the merges.\n\n#### -q\n\nDo not complain about a failed merge program (a merge program failure usually indicates\nconflicts during the merge). This is for porcelains which might want to emit custom\nmessages.\n\nIf git merge-index is called with multiple <file>s (or -a) then it processes them in turn\nonly stopping if merge returns a non-zero exit code.\n\nTypically this is run with a script calling Git’s imitation of the merge command from the RCS\npackage.\n\nA sample script called git merge-one-file is included in the distribution.\n\nALERT ALERT ALERT! The Git \"merge object order\" is different from the RCS merge program merge\nobject order. In the above ordering, the original is first. But the argument order to the\n3-way merge program merge is to have the original in the middle. Don’t ask me why.\n\nExamples:\n\ntorvalds@ppc970:~/merge-test> git merge-index cat MM\nThis is MM from the original tree.              # original\nThis is modified MM in the branch A.            # merge1\nThis is modified MM in the branch B.            # merge2\nThis is modified MM in the branch B.            # current contents\n\n\nor\n\ntorvalds@ppc970:~/merge-test> git merge-index cat AA MM\ncat: : No such file or directory\nThis is added AA in the branch A.\nThis is added AA in the branch B.\nThis is added AA in the branch B.\nfatal: merge program failed\n\n\nwhere the latter example shows how git merge-index will stop trying to merge once anything\nhas returned an error (i.e., cat returned an error for the AA file, because it didn’t exist\nin the original, and thus git merge-index didn’t even try to merge the MM thing).\n\n### GIT\n\nPart of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                           GIT-MERGE-INDEX(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "git-merge-index",
        "section": "1",
        "mode": "man",
        "summary": "git-merge-index - Run a merge for files needing merging",
        "synopsis": "git merge-index [-o] [-q] <merge-program> (-a | [--] <file>*)",
        "flags": [
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "Run merge against all files in the index that need merging."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "Instead of stopping at the first failed merge, do all of them in one shot - continue with merging even when previous merges returned errors, and only return the error code after all the merges."
            },
            {
                "flag": "-q",
                "long": null,
                "arg": null,
                "description": "Do not complain about a failed merge program (a merge program failure usually indicates conflicts during the merge). This is for porcelains which might want to emit custom messages. If git merge-index is called with multiple <file>s (or -a) then it processes them in turn only stopping if merge returns a non-zero exit code. Typically this is run with a script calling Git’s imitation of the merge command from the RCS package. A sample script called git merge-one-file is included in the distribution. ALERT ALERT ALERT! The Git \"merge object order\" is different from the RCS merge program merge object order. In the above ordering, the original is first. But the argument order to the 3-way merge program merge is to have the original in the middle. Don’t ask me why. Examples: torvalds@ppc970:~/merge-test> git merge-index cat MM This is MM from the original tree. # original This is modified MM in the branch A. # merge1 This is modified MM in the branch B. # merge2 This is modified MM in the branch B. # current contents or torvalds@ppc970:~/merge-test> git merge-index cat AA MM cat: : No such file or directory This is added AA in the branch A. This is added AA in the branch B. This is added AA in the branch B. fatal: merge program failed where the latter example shows how git merge-index will stop trying to merge once anything has returned an error (i.e., cat returned an error for the AA file, because it didn’t exist in the original, and thus git merge-index didn’t even try to merge the MM thing)."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "-a",
                        "lines": 2,
                        "flag": "-a"
                    },
                    {
                        "name": "-o",
                        "lines": 4,
                        "flag": "-o"
                    },
                    {
                        "name": "-q",
                        "lines": 39,
                        "flag": "-q"
                    }
                ]
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}