Branch Workflow
Rule: NEVER commit directly to main
Before every git commit, check the current branch:
bash
git branch --show-current
If on main:
- •STOP — do not commit
- •Create a feature branch first:
git checkout -b <branch-name> - •Then commit to the feature branch
Branch Naming
Use descriptive branch names:
- •
fix/<description>— bug fixes - •
feat/<description>— new features - •
chore/<description>— maintenance, lint, docs - •
release/v<X.Y.Z>— release branches aggregating multiple changes
Workflow
- •
git checkout -b feat/my-feature(from main) - •Make changes, commit to feature branch
- •
git push -u origin feat/my-feature - •Create PR via
gh pr create --base main - •Wait for CI, check review feedback (see
pr-release-gatekeeperskill) - •Merge via
gh pr merge --squash --admin --delete-branch
Anti-Patterns
- •❌
git commitwhile onmain - •❌
git push origin maindirectly - •❌ Committing to main then trying to reset when push is rejected
- •❌ Using
--forceto push to protected branches