From cd6337f1373867306ca62fc597a5ea93c18fbaf0 Mon Sep 17 00:00:00 2001 From: tekkub Date: Sat, 6 Nov 2010 20:47:40 -0600 Subject: Markdown! --- _posts/2009-10-10-subtree-merge.markdown | 77 ++++++++++++++++++++++++++++++++ _posts/2009-10-10-subtree-merge.textile | 74 ------------------------------ 2 files changed, 77 insertions(+), 74 deletions(-) create mode 100644 _posts/2009-10-10-subtree-merge.markdown delete mode 100644 _posts/2009-10-10-subtree-merge.textile (limited to '_posts') diff --git a/_posts/2009-10-10-subtree-merge.markdown b/_posts/2009-10-10-subtree-merge.markdown new file mode 100644 index 0000000..78100d4 --- /dev/null +++ b/_posts/2009-10-10-subtree-merge.markdown @@ -0,0 +1,77 @@ +--- +layout: default +title: Working with subtree merge +description: How to use subtree merge to merge one repo into another as a subpath. +categories: git_ninjutsu +--- + +There are times when submodules are not adequate for the task at hand. For example, blending multiple repos together into one single repo while still maintaining the history of each repo. To do this, the subtree merge strategy is a better solution. + +Setting up and doing the first merge +------------------------------------ + +For this example, we'll make an empty "parent" repo and merge two other repos into it as subpaths. + + [tekkub@tekBook: ~/tmp master*] $ mkdir test + [tekkub@tekBook: ~/tmp master*] $ cd test + [tekkub@tekBook: ~/tmp/test master*] $ git init + Initialized empty Git repository in /Users/tekkub/tmp/test/.git/ + + [tekkub@tekBook: ~/tmp/test master#] $ touch .gitignore + [tekkub@tekBook: ~/tmp/test master#] $ git add .gitignore + [tekkub@tekBook: ~/tmp/test master#] $ git commit -m "initial commit" + [master (root-commit) 3146c2a] initial commit + 0 files changed, 0 insertions(+), 0 deletions(-) + create mode 100644 .gitignore + + [tekkub@tekBook: ~/tmp/test master] $ git remote add -f cork git://github.com/tekkub/cork.git + Updating cork + warning: no common commits + remote: Counting objects: 1732, done. + remote: Compressing objects: 100% (750/750), done. + remote: Total 1732 (delta 1086), reused 1558 (delta 967) + Receiving objects: 100% (1732/1732), 528.19 KiB | 621 KiB/s, done. + Resolving deltas: 100% (1086/1086), done. + From git://github.com/tekkub/cork + * [new branch] lastbuffed -> cork/lastbuffed + * [new branch] lock_n_mount -> cork/lock_n_mount + * [new branch] master -> cork/master + * [new branch] nothing_to_see_here -> cork/nothing_to_see_here + + [tekkub@tekBook: ~/tmp/test master] $ git merge -s ours --no-commit cork/master + Automatic merge went well; stopped before committing as requested + + [tekkub@tekBook: ~/tmp/test master|MERGING] $ git read-tree --prefix=cork/ -u cork/master + [tekkub@tekBook: ~/tmp/test master+|MERGING] $ git commit -m "Subtree merge in cork" + [master fe0ca25] Subtree merge in cork + + [tekkub@tekBook: ~/tmp/test master] $ git remote add -f panda git://github.com/tekkub/panda.git + Updating panda + warning: no common commits + remote: Counting objects: 974, done. + remote: Compressing objects: 100% (722/722), done. + remote: Total 974 (delta 616), reused 399 (delta 251) + Receiving objects: 100% (974/974), 189.56 KiB, done. + Resolving deltas: 100% (616/616), done. + From git://github.com/tekkub/panda + * [new branch] master -> panda/master + * [new branch] transmute -> panda/transmute + + [tekkub@tekBook: ~/tmp/test master] $ git merge -s ours --no-commit panda/master + Automatic merge went well; stopped before committing as requested + + [tekkub@tekBook: ~/tmp/test master|MERGING] $ git read-tree --prefix=panda/ -u panda/master + [tekkub@tekBook: ~/tmp/test master+|MERGING] $ git commit -m "Subtree merge in panda" + [master 726a2cd] Subtree merge in panda + +Pulling in changes +------------------ + +If the merged repo changes in the future, you can pull in its changes by simply using the `-s subtree` flag: + + [tekkub@tekBook: ~/tmp/test master] $ git pull -s subtree panda master + +Resources +--------- + +* [How to use the subtree merge strategy](http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html) diff --git a/_posts/2009-10-10-subtree-merge.textile b/_posts/2009-10-10-subtree-merge.textile deleted file mode 100644 index 4fcaa9f..0000000 --- a/_posts/2009-10-10-subtree-merge.textile +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: default -title: Working with subtree merge -description: How to use subtree merge to merge one repo into another as a subpath. -categories: git_ninjutsu ---- - -There are times when submodules are not adequate for the task at hand. For example, blending multiple repos together into one single repo while still maintaining the history of each repo. To do this, the subtree merge strategy is a better solution. - -h2. Setting up and doing the first merge - -For this example, we'll make an empty "parent" repo and merge two other repos into it as subpaths. - -
[tekkub@tekBook: ~/tmp master*] $ mkdir test
-[tekkub@tekBook: ~/tmp master*] $ cd test
-[tekkub@tekBook: ~/tmp/test master*] $ git init
-Initialized empty Git repository in /Users/tekkub/tmp/test/.git/
-
-[tekkub@tekBook: ~/tmp/test master#] $ touch .gitignore
-[tekkub@tekBook: ~/tmp/test master#] $ git add .gitignore
-[tekkub@tekBook: ~/tmp/test master#] $ git commit -m "initial commit"
-[master (root-commit) 3146c2a] initial commit
- 0 files changed, 0 insertions(+), 0 deletions(-)
- create mode 100644 .gitignore
-
-[tekkub@tekBook: ~/tmp/test master] $ git remote add -f cork git://github.com/tekkub/cork.git
-Updating cork
-warning: no common commits
-remote: Counting objects: 1732, done.
-remote: Compressing objects: 100% (750/750), done.
-remote: Total 1732 (delta 1086), reused 1558 (delta 967)
-Receiving objects: 100% (1732/1732), 528.19 KiB | 621 KiB/s, done.
-Resolving deltas: 100% (1086/1086), done.
-From git://github.com/tekkub/cork
- * [new branch]      lastbuffed -> cork/lastbuffed
- * [new branch]      lock_n_mount -> cork/lock_n_mount
- * [new branch]      master     -> cork/master
- * [new branch]      nothing_to_see_here -> cork/nothing_to_see_here
-
-[tekkub@tekBook: ~/tmp/test master] $ git merge -s ours --no-commit cork/master
-Automatic merge went well; stopped before committing as requested
-
-[tekkub@tekBook: ~/tmp/test master|MERGING] $ git read-tree --prefix=cork/ -u cork/master
-[tekkub@tekBook: ~/tmp/test master+|MERGING] $ git commit -m "Subtree merge in cork"
-[master fe0ca25] Subtree merge in cork
-
-[tekkub@tekBook: ~/tmp/test master] $ git remote add -f panda git://github.com/tekkub/panda.git
-Updating panda
-warning: no common commits
-remote: Counting objects: 974, done.
-remote: Compressing objects: 100% (722/722), done.
-remote: Total 974 (delta 616), reused 399 (delta 251)
-Receiving objects: 100% (974/974), 189.56 KiB, done.
-Resolving deltas: 100% (616/616), done.
-From git://github.com/tekkub/panda
- * [new branch]      master     -> panda/master
- * [new branch]      transmute  -> panda/transmute
-
-[tekkub@tekBook: ~/tmp/test master] $ git merge -s ours --no-commit panda/master
-Automatic merge went well; stopped before committing as requested
-
-[tekkub@tekBook: ~/tmp/test master|MERGING] $ git read-tree --prefix=panda/ -u panda/master
-[tekkub@tekBook: ~/tmp/test master+|MERGING] $ git commit -m "Subtree merge in panda"
-[master 726a2cd] Subtree merge in panda
- -h2. Pulling in changes - -If the merged repo changes in the future, you can pull in its changes by simply using the @-s subtree@ flag: - -
[tekkub@tekBook: ~/tmp/test master] $ git pull -s subtree panda master
- -h2. Resources - -* "How to use the subtree merge strategy":http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html \ No newline at end of file -- cgit v1.3.1