Skip to content

Instantly share code, notes, and snippets.

@dbu
Created May 31, 2012 14:14
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dbu/2843660 to your computer and use it in GitHub Desktop.
Save dbu/2843660 to your computer and use it in GitHub Desktop.
recursive git status
#!/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";
}
}
@tafkey
Copy link

tafkey commented Jul 26, 2023

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" \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment