aboutsummaryrefslogtreecommitdiff
path: root/Documentation/git-merge-file.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-20 00:17:27 -0700
committerJunio C Hamano <gitster@pobox.com>2009-11-29 23:11:46 -0800
commit73eb40eeaaebc5ebae283c06286b96b4aea00143 (patch)
tree79b7e3d0bcc3c57e8dcec293fb95286cd4342189 /Documentation/git-merge-file.txt
parent44148f2daf6e1ac3fe087dd07da2930411b3bcf2 (diff)
downloadgit-73eb40eeaaebc5ebae283c06286b96b4aea00143.tar.gz
git-73eb40eeaaebc5ebae283c06286b96b4aea00143.tar.xz
git-merge-file --ours, --theirs
Sometimes people want their conflicting merges autoresolved by favouring upstream changes. The standard answer they are given is to run "git diff --name-only | xargs git checkout MERGE_HEAD --" in such a case. This is to accept automerge results for the paths that are fully resolved automatically, while taking their version of the file in full for paths that have conflicts. This is problematic on two counts. One is that this is not exactly what these people want. It discards all changes they did on their branch for any paths that conflicted. They usually want to salvage as much automerge result as possible in a conflicted file, and want to take the upstream change only in the conflicted part. This patch teaches two new modes of operation to the lowest-lever merge machinery, xdl_merge(). Instead of leaving the conflicted lines from both sides enclosed in <<<, ===, and >>> markers, the conflicts are resolved favouring our side or their side of changes. A larger problem is that this tends to encourage a bad workflow by allowing people to record such a mixed up half-merged result as a full commit without auditing. This commit does not tackle this issue at all. In git, we usually give long enough rope to users with strange wishes as long as the risky features are not enabled by default, and this is such a risky feature. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-merge-file.txt')
-rw-r--r--Documentation/git-merge-file.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt
index 303537357..b9d22764a 100644
--- a/Documentation/git-merge-file.txt
+++ b/Documentation/git-merge-file.txt
@@ -10,7 +10,8 @@ SYNOPSIS
--------
[verse]
'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
- [-p|--stdout] [-q|--quiet] <current-file> <base-file> <other-file>
+ [--ours|--theirs] [-p|--stdout] [-q|--quiet]
+ <current-file> <base-file> <other-file>
DESCRIPTION
@@ -34,7 +35,9 @@ normally outputs a warning and brackets the conflict with lines containing
>>>>>>> B
If there are conflicts, the user should edit the result and delete one of
-the alternatives.
+the alternatives. When `--ours` or `--theirs` option is in effect, however,
+these conflicts are resolved favouring lines from `<current-file>` or
+lines from `<other-file>` respectively.
The exit value of this program is negative on error, and the number of
conflicts otherwise. If the merge was clean, the exit value is 0.
@@ -62,6 +65,11 @@ OPTIONS
-q::
Quiet; do not warn about conflicts.
+--ours::
+--theirs::
+ Instead of leaving conflicts in the file, resolve conflicts
+ favouring our (or their) side of the lines.
+
EXAMPLES
--------