--- name: branch description: Start a branch, either from the default branch or stacked on the current branch. Invoke before the first commit when no usable branch exists yet, when the user asks to split work into a separate pull request, when a change must be merged or released separately (e.g. an API that ships before its client), or when groundwork is better reviewed and merged on its own — never just because a follow-up request could stand alone. --- # Branch Read `../git-workflow/SKILL.md` (relative to this skill's base directory) first if it is not loaded. Run `git status` and `git fetch origin`, and detect the default branch (`git symbolic-ref refs/remotes/origin/HEAD --short`; if unset, run `git remote set-head origin --auto` first). Derive a descriptive name from the planned change (e.g. `feat/add-login`). Never reuse an existing branch; on a name conflict, pick another. Announce the name and the base. - **Independent change:** `git switch --no-track -c `, so the work does not pass through the local default branch. - **Change that depends on the current branch's unmerged commits:** note the current branch as ``, then `git switch -c ` and `git config branch..gh-merge-base `. Push `` before opening the new branch's pull request, but stop and ask the user if `origin/` exists while `git ls-remote --heads origin ` is empty. Ask the user when the dependency is unclear. If `git switch` refuses over uncommitted changes, stop and ask the user. Push the new branch the first time with `git push -u origin `.