Created
November 10, 2017 17:46
-
-
Save leedm777/7f310c9de7cb0e2f3f0bddbb8d694110 to your computer and use it in GitHub Desktop.
Run a git command on lots of 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 | |
# | |
# Run git commands on all the repos | |
# | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
faketty() { | |
#0<&- python3 -c 'import pty, sys; pty.spawn(sys.argv[1:])' "$@" | |
script -q /dev/null "$@" | |
} | |
for dir in */.git; do | |
dir=$(dirname ${dir}) | |
spaces=$(( 70 - ${#dir} )) | |
printf "${GREEN}== ${dir} ==${NC}%*s" ${spaces} | |
faketty git --no-pager -C "${dir}" "$@" 2>&1 | sed -e $'1s/./\\\r\\\n&/' | |
echo -n -e '\r' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment