Skip to content

Instantly share code, notes, and snippets.

@bent-rasmussen
Last active January 5, 2019 15:23
Show Gist options
  • Save bent-rasmussen/0de1a70b563017f9210e76039892bdce to your computer and use it in GitHub Desktop.
Save bent-rasmussen/0de1a70b563017f9210e76039892bdce to your computer and use it in GitHub Desktop.
"git pull" for all git subdirectories
cls
Push-Location
Set-Location E:\Git\ # edit this path for your location or use ./
Write-Host ("git pull on all directories under " + (Resolve-Path .\).Path) -ForegroundColor Cyan
""
Get-ChildItem -Directory -path ./ <# add -Recurse to include all subdirectories recursively #> | ForEach-Object {
if (Test-Path ($_.FullName + "/.git") -PathType Container) {
Write-Host $_.FullName -NoNewline -ForegroundColor Green
Write-Host ">" -NoNewLine -ForegroundColor Gray
Write-Host "git pull" -ForegroundColor White
""
Push-Location -Path $_
&git.exe pull
Pop-Location
""
}
}
Pop-Location
"Exiting in 3 seconds"
Start-Sleep -s 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment