Skip to content

submodules are hard to work with

Git submodules are not nearly as convenient as svn externals for the developer. The dev typically has to specify --recursive or --recurse-submodules, and more-or-less has to be familiar with git foreach. Recommend a set of aliases to ease this issue.

I've been using these aliases, which I manually edit in ~/.gitconfig:

[alias]
        alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
        checkoutall = "! git checkout  ; git submodule foreach --recursive git checkout "
        pullall = "! git submodule foreach --recursive \"git pull  ||: \"; echo "Entering ." ; git pull "
        statusall = "! echo "Entering ."; git internalshortstatus ; git submodule foreach --recursive git internalshortstatus "
        stat = "status"
        internalshortstatus = "! tput setaf 4 ; git status 2>&1 |grep ahead; tput sgr0 ; git status -s"

Will mentioned a way to store these aliases in a repo, however, I think we want to use them with a variety of umbrellas (trsys_umbrella, aware_umbrella, cfar, peasoup_umbrella). Does your proposed solution nicely deal with this, without having code duplication?

Edited by Jason Hiser