Skip to content

Instantly share code, notes, and snippets.

@etcetra7n
Last active June 1, 2025 12:09
Show Gist options
  • Save etcetra7n/dfa4d491e41ea3ec29c41a64bf968797 to your computer and use it in GitHub Desktop.
Save etcetra7n/dfa4d491e41ea3ec29c41a64bf968797 to your computer and use it in GitHub Desktop.
Run git status in all repos
$parentFolder = Get-Location
Get-ChildItem -Path $parentFolder -Directory | ForEach-Object {
if (Test-Path "$($_.FullName)\.git") {
Push-Location $_.FullName
$out = git status
if ($out -match "Your branch is ahead of") {
Write-Host ("{0,-50} {1}" -f $($_.FullName), "Push required") -ForegroundColor Yellow
} elseif ($out -match "Your branch is behind") {
Write-Host ("{0,-50} {1}" -f $($_.FullName), "Pull required") -ForegroundColor Red
} elseif ($out -match "working tree clean") {
Write-Host ("{0,-50} {1}" -f $($_.FullName), "Clean") -ForegroundColor Green
} else {
Write-Host ("{0,-50} {1}" -f $($_.FullName), "Pending commits") -ForegroundColor Red
}
Pop-Location
}
}
Write-Host
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment