-
-
Save nfreear/55b52827c46485218129b6b00b73adb9 to your computer and use it in GitHub Desktop.
Recursive git status (PHP + Bash)
This file contains 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 php | |
<?php | |
/** | |
* Recursive Git status. | |
* | |
* @author NDF, 01-August-2017 (edits only) | |
* @link https://gist.github.com/dbu/2843660 | |
* @link https://gist.github.com/nfreear/55b52827c46485218129b6b00b73adb9 | |
*/ | |
define( 'FIND_CMD', 'find . -type d -name \'.git\' | sed -e "s/\.git//"' ); | |
define( 'GIT_CLEAN', 'nothing to commit, working tree clean' ); | |
$repos = []; | |
exec( FIND_CMD, $repos ); | |
foreach ($repos as $repo) { | |
$status = shell_exec( "cd $repo && git status" ); | |
if (false === strpos( $status, GIT_CLEAN )) { | |
echo ">> $repo\n" . str_repeat( '-', strlen($repo) + 3 ) . "\n$status\n"; | |
} | |
} | |
# End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment