Created
May 31, 2012 14:14
-
-
Save dbu/2843660 to your computer and use it in GitHub Desktop.
recursive git status
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/php | |
<?php | |
$repos = array(); | |
exec('find -type d -name .git | sed -e "s/\.git//"', $repos); | |
foreach ($repos as $repo) { | |
$status = shell_exec("cd $repo && git status"); | |
if (false == strpos($status, 'nothing to commit (working directory clean)')) { | |
echo "$repo\n" . str_repeat('-', strlen($repo)) . "\n$status\n\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This one (1) produces a slim output, and (2) starts printing the results instantly (you don't have to wait it to finish to see the final output):
find . -maxdepth 2 -name .git -type d -exec sh -c "cd {}/..; pwd; git status -s" \;