Is there a way to add a subdirectory of a remote repository into a subdirectory of my repository with git-subtree?
Suppose I have this main reposito
I was able to do something like this by adding :dirname to the read-tree command. (note that I'm actually just trying to learn git and git-subtrees myself this week, and trying to setup an environment similar to how I had my projects in subversion using svn:externals -- my point being that there might be a better or easier way than the commands I'm showing here...)
So for example, using your example structure above:
git remote add library_remote _URL_TO_LIBRARY_REPO_
git fetch library_remote
git checkout -b library_branch library_remote/master
git checkout master
git read-tree --prefix=dir1 -u library_branch:libdir