From: "R. Andrew Ohana" <>

This is preferable to just aborting when no
common ancestor is found since it handles merges
of intersecting branches.

This is incredibly useful functionality when
consolidating multiple repositories (potentially
after using filter-branch to fix paths).


Signed-off-by: R. Andrew Ohana <>
--- | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ b/
index 8643f74..582ae69 100755
--- a/
+++ b/
@@ -48,6 +48,7 @@ MRC=$(git rev-parse --verify -q $head)
 MRT=$(git write-tree)
+EMPTY_TREE=$(git hash-object -t tree /dev/null)
 for SHA1 in $remotes
        case "$OCTOPUS_FAILURE" in
@@ -67,7 +68,9 @@ do
                eval pretty_name=\${GITHEAD_$SHA1_UP:-$pretty_name}
        common=$(git merge-base --all $SHA1 $MRC) ||
-               die "Unable to find common commit with $pretty_name"
+               # Try with an empty tree if no common ancestor was
+               # found, since it is common to all trees.
+               common=$EMPTY_TREE
        case "$LF$common$LF" in

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to