Last active
December 31, 2021 12:35
-
-
Save vi7/0f8d9b733e5ebd4e5512448d665050bc to your computer and use it in GitHub Desktop.
Oneliner scripts to check Git working tree status for multiple repositories in a batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Collection of oneliner scripts to check Git working tree status for multiple repositories in a batch | |
set -e | |
# The most simple, prints all the git repos found and outputs not commited changes if any | |
for dir in $(find . -type d -name '.git'); do pushd $dir/.. >/dev/null; pwd; git status --short; popd >/dev/null; done | |
# Print paths to repositories with uncommitted changes only | |
for dir in $(find . -type d -name '.git'); do pushd $dir/.. >/dev/null; if [ $(git status --short | wc -l) -ne 0 ]; then pwd; fi; popd >/dev/null; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment