Skip to content

Instantly share code, notes, and snippets.

@leedm777
Created November 10, 2017 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leedm777/7f310c9de7cb0e2f3f0bddbb8d694110 to your computer and use it in GitHub Desktop.
Save leedm777/7f310c9de7cb0e2f3f0bddbb8d694110 to your computer and use it in GitHub Desktop.
Run a git command on lots of repos
#!/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