Last active
November 16, 2020 11:26
-
-
Save paulera/893ba129ea7629fb8c3cd33970df40a7 to your computer and use it in GitHub Desktop.
Run a git command in all folders (same level, not recursive) that are a git repo.
This file contains hidden or 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 | |
# | |
# Usage: gitall status | |
# gitall fetch | |
# gitall checkout master | |
# gitall ...git parameters... | |
# | |
if [[ "$OSTYPE" =~ "darwin" ]]; then | |
# MAC | |
ESC="\x1B" | |
else | |
ESC="\e" | |
fi | |
echo -n -e "\nCOMMAND: " | |
echo -e "$ESC[01;33m$(basename $0) $*$ESC[0m\n" | |
for i in *; do | |
if [ -d "$i/.git" ]; then | |
echo -e "$ESC[01;36m-----> "$i"$ESC[0m" | |
echo | |
cd $i | |
git $* | |
cd .. | |
echo | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment