Created
February 1, 2017 09:21
-
-
Save danbarratt/4630e027c5167bf29279d242d13fabed to your computer and use it in GitHub Desktop.
Run 'git gc' in each subdirectory
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
$originalWorkingDir = Get-Location; | |
$subDirectories = dir -Directory; | |
Foreach ($subDirectory in $subDirectories) | |
{ | |
$projectDir = Join-Path $originalWorkingDir $subDirectory; | |
$gitDir = Join-Path $projectDir '.git' | |
if (Test-Path $gitDir -PathType Container) | |
{ | |
Write-Host "$projectDir> $Env:ProgramFiles\Git\bin\git.exe gc"; | |
Set-Location -Path $projectDir; | |
Start-Process "$Env:ProgramFiles\Git\bin\git.exe" -ArgumentList 'gc' -Wait; | |
} | |
} | |
Set-Location -Path $originalWorkingDir; | |
Write-Host 'All Done!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment