Skip to content

Instantly share code, notes, and snippets.

@dudadornelles
Last active December 5, 2016 23:28
Show Gist options
  • Save dudadornelles/781d9017c3cbc44cb558 to your computer and use it in GitHub Desktop.
Save dudadornelles/781d9017c3cbc44cb558 to your computer and use it in GitHub Desktop.
gitr - run git on all subdirs that are git repos
#!/bin/bash
GREEN='\033[0;32m'
NC='\033[0m'
function git_execute_r {
for dir in `ls -l1d */.git`; do
pushd `dirname $dir` >/dev/null
printf "${GREEN} :: @ `pwd`\n${NC}"
git $@
popd >/dev/null
done
}
git_execute_r $@
# e.g: gitr status will show the status of all your subdirs git repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment