Tuesday, September 23, 2014

GIT: update ALL REPOS in current directory

If you have a ZILLION GIT repositories in your current workspace you may benefit from a Bash shell command that does operations on all of them at one swoop.

function git_all_REPOS_in_current_directory() {
    for DIRECTORY in ls -d */
        #echo "directory: $DIRECTORY"
        git fetch
        # do more as need like git rebase, etc. I prefer to do it MANUALLY
        # get modules up to date
        git submodule foreach git fetch
        git submodule foreach git rebase