Last active
January 5, 2019 15:23
-
-
Save bent-rasmussen/0de1a70b563017f9210e76039892bdce to your computer and use it in GitHub Desktop.
"git pull" for all git subdirectories
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
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