Skip to content

Instantly share code, notes, and snippets.

@raogrr
Forked from Makistos/git-repo-statuses.sh
Created December 18, 2022 07:01
Show Gist options
  • Save raogrr/51255db862fe028f9542c466b69eca08 to your computer and use it in GitHub Desktop.
Save raogrr/51255db862fe028f9542c466b69eca08 to your computer and use it in GitHub Desktop.
Get a nice list of git repository statuses using the repo tool. #repo #git #git-status
# 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
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment