git-branching
Branching strategy and lifecycle: GitHub Flow default, trunk-based criteria, release branches, worktrees, PR preparation.
SKILL.mdskills/git/git-branching/SKILL.md
GitHubgit-branching
One feature, one branch, one short life. Strategy follows release reality, not habit.
Inspection
Check team size, release cadence, parallel supported versions, and current branch lifetimes before prescribing a model.
Decision rules
GitHub Flow default; trunk-based only with CI + flags; long-lived branches only for parallel releases; delete after merge.
Activate when
- Choosing a branching model, managing branch lifecycle, working across parallel streams, preparing PRs.
Do NOT activate for
- Daily commit/push mechanics (git-workflow) or releases (git-release).
Procedure
- Model: GitHub Flow default (short
feature/*→ PR → merge → deploy). Trunk-based only with strong CI + flags. Long-lived release branches only for parallel supported versions. - Lifecycle: branch from current main, keep alive for days not weeks, rebase or merge to stay current, delete after merge.
- Parallel streams: one branch per worktree; worktrees share refs/stash;
git worktree pruneafter manual deletions. - Wrong-branch commits: move with
checkout -b+ reset/cherry-pick (see git-recovery), don't drag unrelated work along. - PR prep: atomic commits, protection requirements checked,
ghPR if available (see github/pr-workflow). - Verify: default branch deployable, stale branches pruned, protection active.
Failure modes
GitFlow overhead for continuous-deploy SaaS; branches living for weeks; stale branches nobody owns; protection missing on main.
Escalation
Daily mechanics → git/git-workflow; release branches → git/git-release.