branch
Load this skill when creating or naming a git branch, or starting new work from main: the prefix (feat/, fix/, chore/, docs/, test/, refactor/) and the short description.
SKILL.mdarchive/ceh-git-workflow/skills/branch/SKILL.md
GitHubBranch
Trunk-based development. main is always deployable. Branch from main only — never from
another feature branch. Delete branches after merge.
Procedure
Start new work from an up-to-date
main:git checkout main git pull origin main git checkout -b <type>/<short-description>For anything long-lived, keep the branch current by rebasing on
mainrather than mergingmainin — it keeps history linear and the eventual PR diff clean:git fetch origin git rebase origin/main git push --force-with-lease # your own branch only; --force-with-lease, never --forceDo this before opening the PR and again if
mainmoves ahead while the PR is in review.When work runs alongside another session or agent in the same checkout (a multi-task plan while the user keeps editing, or a second, independent task started next to one in progress), isolate it in a worktree before the first edit. Two routes keep the user in the session:
- To isolate this session, call the
EnterWorktreetool. - For a second parallel session, tell the user to open another terminal and run
claude --worktree <name>, and to open it in its own editor window (code .claude/worktrees/<name>). Never launch it yourself: aclaude -prun from Bash is headless, so the user cannot talk to it and it skips the cleanup prompt on exit.
Prefer these over a raw
git worktree add, because Claude Code tracks the worktree and offers to remove it on exit. It names the branchworktree-<name>: rename it withgit branch -m <type>/<short-description>before the first push. A Claude Code worktree branches from the default branch, not from the currentHEAD, unlessworktree.baseRefis"head"insettings.json, so check its base before building on unmerged work.- To isolate this session, call the
Naming
<type>/<short-description>
| Prefix | When to use | Example |
|---|---|---|
feat/ |
New feature | feat/session-replay |
fix/ |
Bug fix | fix/token-expiry-edge-case |
chore/ |
Maintenance, tooling, dependency updates | chore/update-dependencies |
docs/ |
Documentation only | docs/add-onboarding-guide |
test/ |
Test additions or fixes with no source changes | test/reasoning-engine-invariants |
refactor/ |
Code changes without feature or bug changes | refactor/extract-auth-middleware |
Short description: lowercase, hyphen-separated, 3–5 words.
Rules
- Branch from
mainonly, so every branch starts from a deployable state and its diff stays scoped to one concern — branching off another feature branch entangles unmerged work and bloats the eventual PR. - Rebase is fine locally during development.
- Force-push is allowed only on your own feature branch (never on
main).