Git Subtree Split: This is what Symfony2 does every night to set standalone Components!

First we need to get the git-subtree project:

~ git clone git@github.com:cordoval/git-subtree.git
~ sudo apt-get install asciidoc
~ sudo make install
~ sudo ./install // just to be sure :D

Now that our tool to do the job is installed it is time to filter all the commits and create our new repository, push to github and then add prehaps a composer to it that can in turn require the other dependency of Config Component.

~ git subtree split -P src/Symfony/Component/ResourceWatcher
ec140481b9e7b7f18aa10516f5da6e43bbaea47a
~ git checkout ec140481b9e7b7f18aa10516f5da6e43bbaea47a
~ git checkout -b component/resourceWatcher
// from here on you can push to github.com

Now our component is ready to be sourced from any project’s composer.json. Just remember to include also the Config component dependency.
You can find my personal repo at https://github.com/cordoval/ResourceWatcher.

Update: Thanks to @Stof for this link http://help.github.com/split-a-subpath-into-a-new-repo/
They do it this way which makes a lot more sense 😀 and perhaps more git learning oriented:

[tekkub@tekBook: ~/tmp/github-gem master] $ git filter-branch --prune-empty --subdirectory-filter lib master

Leave a Reply

Your email address will not be published. Required fields are marked *