Skip to content

Instantly share code, notes, and snippets.

@brunomartinspro
Created November 7, 2019 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunomartinspro/00fd44dbf2771fb3b9f0ee2ff64a6b52 to your computer and use it in GitHub Desktop.
Save brunomartinspro/00fd44dbf2771fb3b9f0ee2ff64a6b52 to your computer and use it in GitHub Desktop.
Update all Git Repositories in a Folder
$currentLocation = get-location
Write-Host("Current Location: $currentLocation")
$directories = Get-Childitem -Path $currentLocation -Directory
foreach($directory in $directories)
{
Write-Host("-------------- Starting $directory --------------")
Set-Location $currentLocation\$directory
try
{
git fetch origin
git checkout develop
git pull
}
catch
{
Write-Host("An Error Occured in $directory")
}
Write-Host("-------------- Ending $directory --------------")
Set-Location $currentLocation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment