My use case for git submodules

I have been chatting on IRC about how I’m learning git so I can use submodules and my friend @indigo wants to know my use case, so this post makes some effort to explain that with reference to one specific example.

I have a web framework/toolkit I am experimenting with called Mudball which is here: https://github.com/jj5/mudball

I use Mudball in (some of) my web projects, for example: https://github.com/jj5/www.jjlab.net

In the main project (in this case www.jjlab.net) I have a copy of Mudball in the ext/mudball directory. At the moment ext/mudball is setup as a git submodule.

I open the main project in my IDE (or text editor) and I want to be able to work on both the main application and the web framework/toolkit at the same time. Then when I’m done with some changes I want to run my `gui` script (it stands for “git update interactive”, not “graphical user interface”) which will increment my version numbers in inc/version.php and ext/mudball/inc/version.php and then add/commit/push any changes in both the main project and the web framework/toolkit.

The code for the `gui` command is here: kickass-libexec/bin/lx-gui.sh, it mostly just defers to lx_vcs_sync() which is here: kickass-libexec/src/2-module/vcs/vcs.sh.

The code which updates the version numbers is here: kickass-libexec/bin/lx-version-increment-patch.sh, it mostly just defers to other modules which are here: kickass-libexec/bin/libexec/version-increment-patch.php and here: kickass-libexec/bin/libexec/inc/version.php.

I have been using a similar setup for a long time with Subversion which uses the svn:externals facility (in place of git submodules) and I have a few scripts which help me manage that. My main tooling for this is known as svnman which is a bunch of scripts I wrote myself: Svnman.