CARVIEW |
Guides: Developing with Submodules
Git Submodules are actually pretty great. Here’s a simple way to manage submodule development from within an open source project.
Say there’s an Awesome Framework, and you want to write an open source plugin for it.
First create the plugin.
$ gh create my-fantastic-plugin
Next clone the framework.
$ gh clone defunkt/my-awesome-framework $ cd my-awesome-framework
Now add your plugin as a submodule to the framework.
$ gh submodule add git://github.com/defunkt/my-fantastic-plugin.git plugins/my-fantastic-plugin
Next cd
into the plugin and add your private URL as a remote.
$ cd plugins/my-fantastic-plugin $ gh remote add push git@github.com:defunkt/my-fantastic-plugin.git
And that’s it. Make changes from within my-awesome-framework/plugins/my-fantastic-plugin
and, when you’re ready, just gh push push master
.
Best of all: people cloning your my-awesome-framework
fork will have no problem pulling down your my-fantastic-plugin
submodule, as you’ve registered the public clone URL for the submodule. The commands
$ gh submodule init $ gh submodule update
Will pull the submodules into the current repository.
This is how I develop textmate.el from within my Emacs config while keeping the submodule URL public.
Check out my-awesome-framework to see this Guide’s example in action.