Skip to content

Instantly share code, notes, and snippets.

@thiagomarinho
Last active March 29, 2019 12:25
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 thiagomarinho/479f4585f931e6c2c4819d84db47bdd3 to your computer and use it in GitHub Desktop.
Save thiagomarinho/479f4585f931e6c2c4819d84db47bdd3 to your computer and use it in GitHub Desktop.
Git status for many repositories in one directory + git diff if there are changes
#!/bin/bash
# XXX add parameter to accept a path to show status
for d in */ ; do
echo;
echo '-------------------------------'
echo "Git status $d"
cd $d
if [ -z "$(git status --porcelain)" ]; then
echo; echo 'Repository is clean!'
else
git --no-pager diff
fi
cd ..
echo;
echo '-------------------------------'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment