Skip to content

Instantly share code, notes, and snippets.

@cjsewell
Last active November 18, 2015 03:34
Show Gist options
  • Save cjsewell/36c8a7ff1a608cf18299 to your computer and use it in GitHub Desktop.
Save cjsewell/36c8a7ff1a608cf18299 to your computer and use it in GitHub Desktop.
Find Silverstripe modules which have uncommitted changes.
<?php
$gitDirs = array_merge(glob('*/.git', GLOB_ONLYDIR), glob('themes/*/.git', GLOB_ONLYDIR));
$origWorkingDir = getcwd();
foreach ($gitDirs as $dir) {
chdir(dirname($dir));
$getStatus = shell_exec("git status -s");
if ($getStatus) {
echo dirname($dir) . PHP_EOL;
}
chdir($origWorkingDir);
}
@cjsewell
Copy link
Author

Intended to be called from the command line in your project directory

eg

/var/www/my.website.com/$ php checkUncommitted.php;

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