Run before anything else, before planning or editing.
- Check the current branch (
git branch --show-current). - If you are on
main, you must branch — never edit directly onmain. - Ensure
mainis current first:git pull origin main(rebase ontoupstream/mainif working from a fork). - If a GitHub issue is in play, fetch it with
ghand derive the branch from it:gh issue view <number> --json number,title,labels— read the title and labels- Pick the
<type>from the labels/intent (fixfor a bug,featfor an enhancement, etc.) - Build the name as
<type>/<number>-<slug>, where<slug>is the issue title lowercased, non-alphanumerics →-, trimmed (e.g. issue #1234 "ScrollView insets wrong on iOS" →fix/1234-scrollview-insets-wrong-on-ios)
- If no issue is in play, name the branch
<type>/<short-description>from the change itself (e.g.feat/date-picker-range). - Resolve the branch:
- If it already exists, check it out.
- Otherwise create it from up-to-date
main.
- Check out the branch BEFORE planning. Interactive: confirm the branch name with the user first.
--auto(caller runs autonomously): skip confirmation, just check out.