Documentation / git-merge-file.txton commit Git 2.5.6 (ac33201)
   1git-merge-file(1)
   2=================
   3
   4NAME
   5----
   6git-merge-file - Run a three-way file merge
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
  13        [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
  14        [--[no-]diff3] <current-file> <base-file> <other-file>
  15
  16
  17DESCRIPTION
  18-----------
  19'git merge-file' incorporates all changes that lead from the `<base-file>`
  20to `<other-file>` into `<current-file>`. The result ordinarily goes into
  21`<current-file>`. 'git merge-file' is useful for combining separate changes
  22to an original. Suppose `<base-file>` is the original, and both
  23`<current-file>` and `<other-file>` are modifications of `<base-file>`,
  24then 'git merge-file' combines both changes.
  25
  26A conflict occurs if both `<current-file>` and `<other-file>` have changes
  27in a common segment of lines. If a conflict is found, 'git merge-file'
  28normally outputs a warning and brackets the conflict with lines containing
  29<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
  30
  31        <<<<<<< A
  32        lines in file A
  33        =======
  34        lines in file B
  35        >>>>>>> B
  36
  37If there are conflicts, the user should edit the result and delete one of
  38the alternatives.  When `--ours`, `--theirs`, or `--union` option is in effect,
  39however, these conflicts are resolved favouring lines from `<current-file>`,
  40lines from `<other-file>`, or lines from both respectively.  The length of the
  41conflict markers can be given with the `--marker-size` option.
  42
  43The exit value of this program is negative on error, and the number of
  44conflicts otherwise. If the merge was clean, the exit value is 0.
  45
  46'git merge-file' is designed to be a minimal clone of RCS 'merge'; that is, it
  47implements all of RCS 'merge''s functionality which is needed by
  48linkgit:git[1].
  49
  50
  51OPTIONS
  52-------
  53
  54-L <label>::
  55        This option may be given up to three times, and
  56        specifies labels to be used in place of the
  57        corresponding file names in conflict reports. That is,
  58        `git merge-file -L x -L y -L z a b c` generates output that
  59        looks like it came from files x, y and z instead of
  60        from files a, b and c.
  61
  62-p::
  63        Send results to standard output instead of overwriting
  64        `<current-file>`.
  65
  66-q::
  67        Quiet; do not warn about conflicts.
  68
  69--diff3::
  70        Show conflicts in "diff3" style.
  71
  72--ours::
  73--theirs::
  74--union::
  75        Instead of leaving conflicts in the file, resolve conflicts
  76        favouring our (or their or both) side of the lines.
  77
  78
  79EXAMPLES
  80--------
  81
  82`git merge-file README.my README README.upstream`::
  83
  84        combines the changes of README.my and README.upstream since README,
  85        tries to merge them and writes the result into README.my.
  86
  87`git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345`::
  88
  89        merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
  90        `a` and `c` instead of `tmp/a123` and `tmp/c345`.
  91
  92GIT
  93---
  94Part of the linkgit:git[1] suite