summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-01 19:34:49 -0800
committerJunio C Hamano <junkio@cox.net>2005-11-03 14:55:10 -0800
commit64da9e604eea25c9c20cfe12618285ccd0bf3cfe (patch)
tree520ffc10b69b8bf3993f49c2d91685820e96b85d
parent123ee3ca7b57c32bb3ecd8cfede20dbb9dd5a8a8 (diff)
downloadgit-64da9e604eea25c9c20cfe12618285ccd0bf3cfe.tar.gz
Add 'ours' merge strategy.
This adds the coolest merge strategy ever, "ours". It can take arbitrary number of foreign heads and merge them into the current branch, with the resulting tree always taken from our branch head, hence its name. What this means is that you can declare that the current branch supersedes the development histories of other branches using this merge strategy. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rwxr-xr-xgit-merge-ours.sh7
-rwxr-xr-xgit-merge.sh2
4 files changed, 10 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 927c89cbac..3edf6b41af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,7 @@ git-merge-base
git-merge-index
git-merge-octopus
git-merge-one-file
+git-merge-ours
git-merge-recursive
git-merge-resolve
git-merge-stupid
diff --git a/Makefile b/Makefile
index be6101ab23..6c01dc2953 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,7 @@ SCRIPT_SH = \
git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
git-applymbox.sh git-applypatch.sh git-am.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
- git-merge-resolve.sh git-grep.sh
+ git-merge-resolve.sh git-merge-ours.sh git-grep.sh
SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \
diff --git a/git-merge-ours.sh b/git-merge-ours.sh
new file mode 100755
index 0000000000..a64704f3e5
--- /dev/null
+++ b/git-merge-ours.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+# Pretend we resolved the heads, but declare our tree trumps everybody else.
+#
+exit 0
diff --git a/git-merge.sh b/git-merge.sh
index dd104db7ad..b810fceaf8 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -14,7 +14,7 @@ usage () {
# all_strategies='resolve recursive stupid octopus'
-all_strategies='recursive octopus resolve stupid'
+all_strategies='recursive octopus resolve stupid ours'
default_strategies='resolve octopus'
use_strategies=