Skip to content

Instantly share code, notes, and snippets.

@pawelklimczyk
Created November 6, 2016 09:16
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