Created
February 9, 2018 20:07
-
-
Save aaronhoffman/ce9152052b3f830152925f5d6077b692 to your computer and use it in GitHub Desktop.
Given a path, find all git repos and perform a git fetch
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 ( | |
[string]$path = "c:\dev\" | |
) | |
Write-Output "Recurse in $path for hidden .git folders..." | |
$gitdirs = Get-ChildItem -Recurse -Path $path -Force -Filter ".git" | |
Write-Output "Found: $($gitdirs.Length) repos" | |
$cwd = (Get-Item -Path ".\" -Verbose).FullName | |
foreach ($gitdir in $gitdirs) | |
{ | |
Write-Output "Fetch all for $($gitdir.Parent.FullName)" | |
Set-Location $gitdir.Parent.FullName | |
&git fetch --all | |
} | |
Set-Location $cwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment