Get a nice list of git repository statuses using the repo tool. #repo #git #git-status
#!/bin/sh
case `git status` in
"HEAD detached at"*|"Not currently on any branch."*)
if [ "`git status --porcelain`" != "" ]; then
echo "$REPO_PROJECT has changes"
fi
;;
*) echo "$REPO_PROJECT not at detached state"
;;
esac
# Get a list of all the repos
repo forall -c 'echo $REPO_PROJECT; git status -s'
# Just list the changed repos
repo forall -c 'if [ "$(git status --porcelain)" != "" ]; then echo $REPO_PROJECT; fi'
# Print the contents, also only include projects from given list
repo forall $(cat projects) -c 'if [ "$(git status --porcelain)" != "" ]; then echo $REPO_PROJECT; git status -s; fi'
# Check both branch and (un)staged commits
repo forall -c repo-diff