refactor: replace git checkout with git switch/restore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
stephenleo
2026-04-05 13:03:13 +08:00
parent 6616ecf548
commit 08b8191978

View File

@@ -118,13 +118,13 @@ DECIDE how much to run based on whether the graph already exists:
BRANCH SAFETY — before anything else, ensure the repo root is on main:
git branch --show-current
If not main:
git checkout -- .
git checkout main
git restore .
git switch main
git pull --ff-only origin main
If checkout fails because a worktree claims the branch:
If switch fails because a worktree claims the branch:
git worktree list
git worktree remove --force <path>
git checkout main
git switch main
git pull --ff-only origin main
STEPS:
@@ -375,13 +375,13 @@ After all batch stories complete Phase 2, merge every successful story's PR into
2. Repo root branch safety check:
git branch --show-current
If not main:
git checkout -- .
git checkout main
git restore .
git switch main
git reset --hard origin/main
If checkout fails because a worktree claims the branch:
If switch fails because a worktree claims the branch:
git worktree list
git worktree remove --force <path>
git checkout main
git switch main
git reset --hard origin/main
3. Pull main: