Skip to content

Commit 64da9e6

Browse files
author
Junio C Hamano
committed
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>
1 parent 123ee3c commit 64da9e6

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ git-merge-base
5050
git-merge-index
5151
git-merge-octopus
5252
git-merge-one-file
53+
git-merge-ours
5354
git-merge-recursive
5455
git-merge-resolve
5556
git-merge-stupid

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SCRIPT_SH = \
8989
git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
9090
git-applymbox.sh git-applypatch.sh git-am.sh \
9191
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
92-
git-merge-resolve.sh git-grep.sh
92+
git-merge-resolve.sh git-merge-ours.sh git-grep.sh
9393

9494
SCRIPT_PERL = \
9595
git-archimport.perl git-cvsimport.perl git-relink.perl \

git-merge-ours.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2005 Junio C Hamano
4+
#
5+
# Pretend we resolved the heads, but declare our tree trumps everybody else.
6+
#
7+
exit 0

git-merge.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ usage () {
1414

1515
# all_strategies='resolve recursive stupid octopus'
1616

17-
all_strategies='recursive octopus resolve stupid'
17+
all_strategies='recursive octopus resolve stupid ours'
1818
default_strategies='resolve octopus'
1919
use_strategies=
2020

0 commit comments

Comments
 (0)