Files
Sourcetree-Actions/upstream_sync.ps1
2025-11-09 04:51:27 -07:00

22 lines
634 B
PowerShell

# Sync from upstream to your fork
# Detect default branch (main/master/etc)
$branch = git symbolic-ref --short refs/remotes/origin/HEAD
$branch = $branch -replace "origin/", ""
Write-Host "Default branch detected: $branch" -ForegroundColor Yellow
Write-Host "Fetching upstream..." -ForegroundColor Cyan
git fetch upstream
Write-Host "Checking out $branch..." -ForegroundColor Cyan
git checkout $branch
Write-Host "Merging upstream/$branch..." -ForegroundColor Cyan
git merge upstream/$branch
Write-Host "Pushing to origin..." -ForegroundColor Cyan
git push origin $branch
Write-Host "✅ Sync complete!" -ForegroundColor Green