# Branch creation from default branch Local `` may have stale commits (another session/worktree advanced it) or commits the user authored intending to branch from later. Local git can't distinguish these — ask when unpushed commits are present. ## Decision flow ### 1. Fetch fresh remote base ```bash git fetch --no-tags origin ``` If fetch fails (network, auth, no remote), use the fallback at the bottom. ### 2. Check for unpushed local commits on `` ```bash git log origin/..HEAD --oneline ``` - **Empty output:** set `BASE_REF=origin/` and proceed to step 3. - **Non-empty output:** show the commit list and ask (per the "Asking the user" convention in `SKILL.md`): > "Local `` has N unpushed commits not on `origin/`. Carry them onto the new feature branch, or leave them on local ``?" - **Carry forward** → `BASE_REF=HEAD`. The new branch starts from local HEAD, preserving the commits. - **Leave on ``** → `BASE_REF=origin/`. The new branch starts clean; commits remain on local ``. Never default silently — carrying foreign commits into a PR is worse than asking again. ### 3. Create the feature branch ```bash git checkout -b "$BASE_REF" ``` If checkout fails because uncommitted changes would be overwritten, stash and retry: ```bash git stash push -u -m "ce-commit-push-pr: pre-branch " git checkout -b "$BASE_REF" git stash pop ``` If `git stash pop` reports conflicts, surface the conflict output and the stash ref to the user — do not auto-resolve. ## Fetch failure fallback If `git fetch` fails, branch from current local HEAD: ```bash git checkout -b ``` Note in the user-facing summary that base freshness was not verified. Skip the unpushed-commits check — without a fresh `origin/`, the answer is unreliable.