branch-strategy
Skill3 starsChanged 7 months agoMITView on GitHub
Git branching strategies and workflows. Use when setting up a project's branching model, discussing Git workflow, or deciding between trunk-based and Git Flow approaches.
- Commits and pushes
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 231
Use hyphens (not underscores)
- Distinctive: line 233
Keep description short but clear
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Branch Strategy Guide
Choose and implement the right Git branching strategy.
When to Use
- Setting up a new project's Git workflow
- Discussing branching strategies
- Deciding between trunk-based and feature branches
- Establishing team conventions
Strategy Comparison
| Strategy | Best For | Team Size | Release Frequency |
| Trunk-Based | Continuous deployment | Any | Daily/Hourly |
| GitHub Flow | Web apps, SaaS | Small-Medium | Daily/Weekly |
| Git Flow | Versioned releases | Medium-Large | Scheduled |
Trunk-Based Development
Overview
main ─────●─────●─────●─────●─────●─────●───→
│ │ │ │ │
└─●───┘ └─────●─────┘ └─●
(short-lived feature branches)Characteristics
- Single main branch (
mainortrunk) - Short-lived feature branches (< 1 day)
- Merge to main frequently
- Feature flags for incomplete work
- Continuous integration required
Workflow
# Start feature
git checkout main
git pull
git checkout -b feat/add-login
# Work in small increments
git commit -m "feat: add login form"
git push -u origin feat/add-login
# Create PR same day
gh pr create --title "feat: add login form"
# Merge quickly (after review)
gh pr merge --squashWhen to Use
- Experienced team with good CI/CD
- Continuous deployment
- Feature flags available
- High test coverage
GitHub Flow
Overview
main ─────●─────────────●─────────────●───→
│ │ │
└──●──●──●────┘ │
feature/login │
└──●──●──●────┘
feature/dashboardCharacteristics
mainis always deployable- Feature branches for all changes
- PRs required for merging
- Deploy from
mainafter merge
Workflow
# Start feature
git checkout main
git pull
git checkout -b feature/user-dashboard
# Develop with multiple commits
git commit -m "feat: add dashboard layout"
git commit -m "feat: add metrics widgets"
git commit -m "test: add dashboard tests"
git push -u origin feature/user-dashboard
# Create PR
gh pr create --title "feat: add user dashboard"
# After review, merge
gh pr merge --squash
# Deploy mainBranch Naming
feature/description # New features
fix/description # Bug fixes
docs/description # Documentation
refactor/description # Refactoring
test/description # Test additionsWhen to Use
- Web applications
- Continuous deployment
- Small to medium teams
- Simple release process
Git Flow
Overview
main ─────●───────────────────●───────→
│ │
develop ──●───●───●───●───●───●───●───●───→
│ │ │ │
└─●─●───┘ │ │
feature/a │ │
└─●─●───┘
release/1.0Branches
| Branch | Purpose | Lifetime |
main | Production code | Permanent |
develop | Integration branch | Permanent |
feature/* | New features | Temporary |
release/* | Release preparation | Temporary |
hotfix/* | Production fixes | Temporary |
Workflow
# Start feature
git checkout develop
git checkout -b feature/payment-system
# Develop
git commit -m "feat: add payment form"
git push -u origin feature/payment-system
# Merge to develop (via PR)
gh pr create --base develop
# Start release
git checkout develop
git checkout -b release/1.0.0
# Finalize release
git checkout main
git merge release/1.0.0
git tag v1.0.0
git checkout develop
git merge release/1.0.0
# Hotfix
git checkout main
git checkout -b hotfix/security-patch
# ... fix ...
git checkout main
git merge hotfix/security-patch
git tag v1.0.1
git checkout develop
git merge hotfix/security-patchWhen to Use
- Scheduled release cycles
- Multiple versions in production
- Larger teams
- QA/staging environments
Branch Naming Conventions
Format
<type>/<ticket>-<description>Examples
feature/AUTH-123-oauth-login
fix/BUG-456-cart-calculation
hotfix/SEC-789-xss-vulnerability
release/1.2.0
docs/update-api-referenceGuidelines
- Use lowercase
- Use hyphens (not underscores)
- Include ticket number if applicable
- Keep description short but clear
Environment Branches
Setup
main → Production
staging → Staging environment
develop → Development environmentPromotion Flow
feature/* → develop → staging → main
↓ ↓ ↓
Dev Stage ProdAutomation
# Deploy on merge to specific branches
on:
push:
branches:
- main # Deploy to production
- staging # Deploy to staging
- develop # Deploy to developmentMerge Strategies
Squash Merge
gh pr merge --squash- Combines all commits into one
- Clean history
- Best for feature branches
Merge Commit
gh pr merge --merge- Preserves all commits
- Creates merge commit
- Best for release branches
Rebase
gh pr merge --rebase- Linear history
- Rewrites commits
- Best for small changes
Protected Branches
Recommended Settings
# main branch
- Require PR reviews: 1-2 reviewers
- Require status checks: CI must pass
- Require up-to-date branch
- No force pushes
- No deletions
# develop branch
- Require PR reviews: 1 reviewer
- Require status checks: CI must passMigration Guide
From Git Flow to Trunk-Based
- Implement feature flags
- Increase CI/CD coverage
- Shorten branch lifetimes gradually
- Remove
developbranch - Merge directly to
main
From No Strategy to GitHub Flow
- Protect
mainbranch - Require PRs for all changes
- Set up CI checks
- Train team on workflow
- Establish naming conventions
Decision Checklist
Choose Trunk-Based if:
- Deploy multiple times per day
- Have strong CI/CD
- Can use feature flags
- Team is experienced
Choose GitHub Flow if:
- Deploy daily to weekly
- Want simple workflow
- Don't need versioned releases
- Small to medium team
Choose Git Flow if:
- Have scheduled releases
- Need multiple versions
- Have QA process
- Larger team with roles
In this repository72 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- api-designerSkill
- backend-patternsSkill
- code-reviewerSkill
- debugging-assistantSkill
- golang-testingSkill
- project-guidelines-exampleSkill
- python-testingSkill
- refactoring-guideSkill
- spec-driven-developmentSkill
- tdd-workflowSkill
- verification-loopSkill
- update-docsSkill
- api-docsSkill
- changelog-writerSkill
- readme-generatorSkill
- django-patternsSkill
- django-securitySkill
- django-tddSkill
- django-verificationSkill
- fastapi-patternsSkill
- nextjs-patternsSkill
- react-patternsSkill
- springboot-patternsSkill
- springboot-securitySkill
- springboot-tddSkill
- changelogSkill
- commit-helperSkill
- pr-creatorSkill
- prSkill
- evolveSkill
- instinct-exportSkill
- instinct-importSkill
- instinct-statusSkill
- cleanupSkill
- lint-fixSkill
- refactor-cleanSkill
- update-depsSkill
- continuous-learningSkill
- continuous-learning-v2Skill
- eval-harnessSkill
- iterative-retrievalSkill
- strategic-compactSkill
- golang-patternsSkill
- python-patternsSkill
- rust-patternsSkill
- typescript-patternsSkill
- accessibility-checkerSkill
- build-fixSkill
- code-reviewSkill
- e2eSkill
- performance-reviewerSkill
- security-auditorSkill
- security-reviewSkill
- test-coverageSkill
- checkpointSkill
- deploySkill
- evalSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

