Created
November 7, 2019 16:00
-
-
Save brunomartinspro/00fd44dbf2771fb3b9f0ee2ff64a6b52 to your computer and use it in GitHub Desktop.
Update all Git Repositories in a Folder
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
$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