Extracting Symfony2 bundles using 'git subtree split'
I've been working on a Symfony2 app, and we decided to extract some bundles so they could be used in other projects. I wanted to keep commit history (we're using Git) and found the new subtree functionality to be just the ticket:
First, add a Git remote to the Symfony2 project Git repository. This is the repository which will contain the separated bundle:
git remote add my-bundle-repo git@github.com:yourname/my-bundle-repo.git
Then use git subtree
to create a new branch (called split-bundle) which contains only the code underneath the given prefix, and history relating to those files:
git subtree split --prefix=src/path/to/my/Symfony2Bundle -b split-bundle
Once that's done, push the new branch to your bundle remote, and you're done!
git push my-bundle-repo split-bundle:master
Written by Craig Marvelley
Related protips
1 Response
My two cents on subtree bundles:
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#