Created
March 3, 2020 12:25
-
-
Save Rarst/ebd43af5e2d76bdaf180c7dd76f0fb28 to your computer and use it in GitHub Desktop.
Revisions
-
Rarst revised this gist
Mar 3, 2020 . No changes.There are no files selected for viewing
-
Rarst created this gist
Mar 3, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <?php declare( strict_types=1 ); $path = $argv[1]; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST ); /** @var SplFileInfo $file */ foreach ( $iterator as $file ) { if ( $file->isDir() && '.git' === $file->getBasename() ) { echo $file->getPath() . "\n"; exec( "cd {$file->getPath()} && git gc --aggressive" ); } }