Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(updater): always switch to main before pulling, not just on detached HEAD

[._.]/ Adam Eivyc6a6a03a515a
diff --git a/update.ps1 b/update.ps1
index 751a3c72e8..515edaad17 100644
--- a/update.ps1
+++ b/update.ps1
@@ -94,12 +94,13 @@ function Safe-Install {
exit 1
}
-# Pull latest — ensure we're on a branch first (old updater may have left
-# the repo in detached HEAD after checking out a tag)
+# Pull latest — always switch to main (detached HEAD or feature branch both
+# need to land on main before pulling, or the version won't advance)
Step "git-pull" "running" "Pulling latest changes..."
$headRef = git symbolic-ref -q HEAD 2>$null
-if (-not $headRef) {
- Write-SafeHost "⚠️ Detached HEAD detected — checking out main branch" -ForegroundColor Yellow
+$currentBranch = if ($headRef) { $headRef -replace "refs/heads/", "" } else { "" }
+if ($currentBranch -ne "main") {
+ Write-SafeHost "⚠️ On branch '$currentBranch' — switching to main for update" -ForegroundColor Yellow
Invoke-Logged git checkout main
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
diff --git a/update.sh b/update.sh
index 659baf6aad..59ac0cb134 100755
--- a/update.sh
+++ b/update.sh
@@ -59,11 +59,12 @@ safe_install() {
return 1
}
-# Pull latest — ensure we're on a branch first (old updater may have left
-# the repo in detached HEAD after checking out a tag)
+# Pull latest — always switch to main (detached HEAD or feature branch both
+# need to land on main before pulling, or the version won't advance)
step "git-pull" "running" "Pulling latest changes..."
-if ! git symbolic-ref -q HEAD >/dev/null 2>&1; then
- log "⚠️ Detached HEAD detected — checking out main branch"
+current_branch=$(git symbolic-ref -q --short HEAD 2>/dev/null || echo "")
+if [ "$current_branch" != "main" ]; then
+ log "⚠️ On branch '${current_branch:-detached HEAD}' — switching to main for update"
run git checkout main
fi
run git pull --rebase --autostash