Skip to content

Instantly share code, notes, and snippets.

@skolima
Created January 24, 2023 12:40
Show Gist options
  • Save skolima/375b89b4c557cfe67d71a6624e38642b to your computer and use it in GitHub Desktop.
Save skolima/375b89b4c557cfe67d71a6624e38642b to your computer and use it in GitHub Desktop.
Write-Output "Pulling in latest changes for all repositories..."
# Find all git repositories and update it to the master latest revision
Get-ChildItem -Directory -Recurse -Force -Filter ".git" | ForEach-Object {
Write-Output "Checking " $_.FullName
Push-Location -Path $_
# We have to go to the .git parent directory to call the pull command
Set-Location ..
# finally pull
git checkout main || git checkout master
git fetch --all --prune
git merge origin/main --ff-only || git merge origin/master --ff-only
Pop-Location
}
Write-Output "Complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment