Last active
June 1, 2025 12:09
-
-
Save etcetra7n/dfa4d491e41ea3ec29c41a64bf968797 to your computer and use it in GitHub Desktop.
Run git status in all repos
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 characters
$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