Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Given a path, find all git repos and perform a git fetch
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
You can’t perform that action at this time.