Last active
July 13, 2020 13:49
-
-
Save kulvind3r/a405043c2a28e479f13a773d76f89770 to your computer and use it in GitHub Desktop.
Minimalist git multi script. Make alias 'gm' to script, use as "gm <git_command>" to run command across multiple checked out git repos.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ARG="$1" | |
WORK_DIR=$(pwd) | |
run() { | |
for DIR in $(find $WORK_DIR/ -maxdepth 1 -type d) | |
do | |
cd "${DIR}" | |
[[ -d .git ]] && printf "\n\n==== %s ====\n\n" $(basename ${DIR}) && git $ARG | |
done | |
#Return to work directory | |
cd $WORK_DIR | |
} | |
run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment