Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update all master branches in all repositories
$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 master
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