| @@ Step 4.5 — Detect Checkout Conflicts (new) @@ | |
| ## Step 4: Fetch Latest from Origin | |
| + | ## Step 4.5: Detect Checkout Conflicts |
| + | comm -12 \ |
| + | <(git diff --name-only HEAD | sort -u) \ |
| + | <(git diff --name-only HEAD origin/<default> | sort -u) |
| + | → empty: no stash needed, uncommitted changes carry forward |
| + | → non-empty: stash needed, record conflicting paths |
| @@ Step 5 — Create Branch (conditional stash path) @@ | |
| - | Run: |
| - | git checkout -b <branch> --no-track origin/<default> |
| - | On failure (branch already exists, dirty-tree conflict…): STOP |
| + | When stash needed: |
| + | git stash push -m "branch-agent auto-stash <branch>" |
| + | git checkout -b <branch> --no-track origin/<default> |
| + | git stash pop ← your changes restored on the new branch |
| On pop conflict: preserve stash + recovery instructions + STOP | |
Twitter/X
Bluesky