Skip to content

Instantly share code, notes, and snippets.

@michaelkc
Created March 27, 2018 20:11
Show Gist options
  • Save michaelkc/3b4ebadc98088c2ac9e53c88b99b0d0b to your computer and use it in GitHub Desktop.
Save michaelkc/3b4ebadc98088c2ac9e53c88b99b0d0b to your computer and use it in GitHub Desktop.
Powershell variant of the git-pull-all command, to pull all git repos in subfolders of current folder
$git = "git.exe" # or change to absolute path if not in PATH
$gitRepos = Get-ChildItem -Recurse -Directory | Where-Object { Get-ChildItem $_.FullName -Directory -Hidden -Filter ".git" }
foreach ($gitRepo in $gitRepos)
{
Write-Host "Pulling $($gitRepo.Fullname)"
pushd
cd $gitRepo.Fullname
&$git pull
popd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment