Skip to content

Instantly share code, notes, and snippets.

@gesslar
Last active July 14, 2024 04:17
Show Gist options
  • Save gesslar/5992413395060e2f36b68091827c0c96 to your computer and use it in GitHub Desktop.
Save gesslar/5992413395060e2f36b68091827c0c96 to your computer and use it in GitHub Desktop.
updates all local repos - useful after doing things directly online or dependencies got updated
# Define the array of directories
$repos = @(
"mud.gesslar.dev",
"mupdate",
"ThreshBeep",
"ThreshBuff",
"ThreshChat",
"ThreshColorPercent",
"ThreshCommandRepeater",
"ThreshCopy",
"ThreshKeepalive",
"ThresholdUI",
"ThreshURL"
)
# Base directory
$baseDir = "D:\git"
# Iterate through each directory and perform git pull
foreach ($repo in $repos) {
$repoPath = Join-Path -Path $baseDir -ChildPath $repo
if (Test-Path -Path $repoPath) {
Write-Output "Pulling latest changes in $repo"
Set-Location -Path $repoPath
git pull
git add .
git commit -m "Updating"
git push
} else {
Write-Output "Directory $repoPath does not exist"
}
}
# Reset location to the original working directory
Set-Location -Path $baseDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment