From 0929dfe432b30d18e7e9eaecf97b65085f258d2f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 5 Jan 2008 23:49:16 +0100 Subject: [PATCH] git-merge manpage: add subtree documentation Signed-off-by: Miklos Vajna --- Documentation/merge-strategies.txt | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt index 7df0266..f3ec590 100644 --- a/Documentation/merge-strategies.txt +++ b/Documentation/merge-strategies.txt @@ -33,3 +33,35 @@ ours:: merge is always the current branch head. It is meant to be used to supersede old development history of side branches. + +subtree:: +This merge strategy largely piggy-backs on git-merge-recursive. +When merging trees A and B, if B corresponds to a subtree of A, +B is first adjusted to match the tree structure of A, instead of +reading the trees at the same level. This adjustment is also +done to the common ancestor tree. ++ +If you are pulling updates from B repository into A +repository, the root level of the former corresponds to B/ +subdirectory of the latter. The tree object of B's toplevel +is wrapped in a fake tree object, whose sole entry has name 'B' +and records object name of the true tree, before being used by +the 3-way merge code. ++ +If you are merging the other way, only the B/ subtree of +A is extracted and merged into B's toplevel. ++ +The detection of corresponding subtree is done by comparing the +pathnames and types in the toplevel of the tree. ++ +Example: ++ +---- +git remote add B /path/to/B.git +git fetch +mkdir B +touch B/.gitignore +git add B/.gitignore +git commit -m "add empty B directory" +git merge -s subtree B/master +---- -- 1.5.4.rc2-dirty