Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Last active August 29, 2015 14:03
Show Gist options
  • Save stefansundin/4dbd0c4cfb75ff44ff14 to your computer and use it in GitHub Desktop.
Save stefansundin/4dbd0c4cfb75ff44ff14 to your computer and use it in GitHub Desktop.
Execute `git status` recursively.
#!/bin/bash
# Executes `git status` in any git subdirectories you may have in your working directory.
# Install in a directory that's in your PATH, e.g. /usr/local/bin
# cd /usr/local/bin
# wget https://gist.githubusercontent.com/stefansundin/4dbd0c4cfb75ff44ff14/raw/git-status-rec
# chmod +x git-status-rec
# Then go to your project directory and type:
# git status-rec
for F in *; do
[[ ! -d "$F" ]] && continue
STATUS=`git -C "$F" status -s $* 2> /dev/null`
if [[ -n "$STATUS" ]]; then
echo "$F "$'\e[34m'"[`git -C "$F" rev-parse --abbrev-ref HEAD`]"
git -C "$F" status -s $*
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment