Created
November 6, 2016 09:16
-
-
Save pawelklimczyk/fb5d48003a75009f3c60361ff0c8b110 to your computer and use it in GitHub Desktop.
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
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$rootPath | |
) | |
$directories = Get-ChildItem $rootPath -Directory | |
$baseLocation = Get-Location | |
foreach($dir in $directories) | |
{ | |
Set-Location $dir.FullName | |
$isGitRepo = Get-ChildItem . -Force -Directory | where {$_.Name -eq ".git"} | Measure-Object | |
if($isGitRepo.Count -gt 0) | |
{ | |
$changesLocal = git status -s | Measure-Object | |
if($changesLocal.Count -gt 0) | |
{ | |
Write-Host "$($dir.FullName) $($changesLocal.Count) (local changes)" | |
continue; | |
} | |
$changesRemote = git diff --stat origin/master | Measure-Object | |
if($changesRemote.Count -gt 0) | |
{ | |
Write-Host "$($dir.FullName) $($changesRemote.Count-1) (push remote)" | |
} | |
} | |
} | |
Set-Location $baseLocation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment