I'm trying to use an external SVN repository as a subtree in my repository by 'subtree-merging' it in. I believe that this should keep the history of the files in the library intact, but it's not working - the files from the library that are merged into a subtree in my master branch have no history but for the commit when I add them - here's a history to show what I mean, precisely what I'm going to get to this state follows.
lappy8086:YACYAML jamie$ git log --graph
* commit 0cc6c4e5061741e67d009f3375ce1d2bcd3ab540
| Author: James Montgomerie
| Date: Thu May 17 12:04:43 2012 +0100
|
| Subtree-merge in libYAML (from a git-svn checkout).
|
* commit b5af5af109d77f6adafebc3dcf5a4796a5035a2e
Author: James Montgomerie
Date: Thu May 17 11:47:32 2012 +0100
First commit, add .gitignore.
Here's what I'm doing to try to get this to work:
# check out SVN repo
git svn clone http://svn.pyyaml.org/libyaml/branches/stable libYAML
# create my repo
mkdir YACYAML
cd YACYAML
git init
touch .gitignore
git add .gitignore
git commit -m "First commit, add .gitignore"
# Fetch from git-svn repo I got earlier
git remote add libyaml-svn ../libYAML/
git fetch libyaml-svn
git checkout -b libyaml-svn libyaml-svn/master
# Switch back to master, and try to merge in subtree
git checkout master
git read-tree --prefix=libYAML/ -u libyaml-svn/master
git commit -m "Merge in libYAML as subtree (from git-svn checkout of SVN repo)"
This 'works', but, as I said, when I look at my history I expect to see the full history from the libYAML repo, but I don't - it's as above.
Well, one answer was to install git-subtree and use it to:
which results in what I was looking for (and expected) from doing it manually:
I'd still like to know the correct way to do this without the dependency on git-subtree though.