branching-strategy
Skill4 starsChanged 9 months agoMITView on GitHub
Guide git branching strategies, branch naming, and merge/rebase decisions. Use when the user creates branches, asks about Git Flow vs trunk-based development, discusses merge vs rebase, or is setting up a new repository's branching model.
- Commits and pushes
In this repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-initial-setup.mdcCursor rule
- parallel-task-executionSkill
- subagent-patternsSkill
- task-coordinationSkill
- agent-communicationSkill
- context-managementSkill
- multi-agent-orchestrationSkill
- deploy-strategiesSkill
- github-actions-guideSkill
- pipeline-patternsSkill
- anthropic-sdk-guideSkill
- prompt-engineeringSkill
- tool-use-patternsSkill
- automated-review-setupSkill
- pr-standardsSkill
- review-checklistSkill
- file-organizationSkill
- immutability-patternsSkill
- naming-conventionsSkill
- commit-conventionsSkill
- pr-workflowSkill
- migration-patternsSkill
- query-optimizationSkill
- schema-design-guideSkill
- error-tracingSkill
- log-analysisSkill
- systematic-debuggingSkill
- django-admin-customizationSkill
- django-orm-masterySkill
- drf-api-patternsSkill
- docker-compose-guideSkill
- dockerfile-best-practicesSkill
- multi-stage-buildsSkill
- express-error-handlingSkill
- middleware-patternsSkill
- rest-api-nodeSkill
- async-fastapiSkill
- dependency-injection-fastapiSkill
- pydantic-validationSkill
- concurrency-patterns-goSkill
- error-handling-goSkill
- idiomatic-goSkill
- automation-triggersSkill
- hook-recipesSkill
- pre-post-hooksSkill
- junit-testingSkill
- maven-gradle-guideSkill
- spring-boot-patternsSkill
- mcp-resource-patternsSkill
- mcp-server-creationSkill
- mcp-tool-designSkill
- context-optimizationSkill
- knowledge-persistenceSkill
- memory-patternsSkill
- caching-strategiesSkill
- lazy-loading-patternsSkill
- profiling-guideSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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 25
Use a consistent prefix/slug format:
- Distinctive: line 43
Keep under 50 characters after the prefix
- Distinctive: line 45
Use descriptive slugs, not cryptic abbreviations
- Distinctive: line 125
No long-lived branches except main
- Distinctive: line 155
Golden rule: Never rebase commits that have been pushed to a shared branch.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Branching Strategy
Choose and apply the right branching model for the project's size, team, and release cadence.
When to Use
- Creating a new branch for a feature, fix, or release
- Deciding between merge and rebase
- Setting up a new repository's branching conventions
- Discussing release management and deployment strategies
- Resolving merge conflicts or untangling branch history
Core Patterns
Branch Naming Conventions
Use a consistent prefix/slug format:
# Format: <type>/<ticket-id>-<short-description>
feature/AUTH-123-add-sso-login
fix/BUG-456-null-pointer-on-logout
refactor/TECH-789-extract-auth-service
hotfix/SEC-101-patch-xss-vulnerability
release/v2.3.0
chore/TECH-202-upgrade-node-20
# Without ticket system
feature/add-user-registration
fix/prevent-race-condition-in-cacheRules:
- Lowercase with hyphens (kebab-case)
- Keep under 50 characters after the prefix
- Include ticket ID when available
- Use descriptive slugs, not cryptic abbreviations
Git Flow (Structured Releases)
Best for: projects with scheduled releases, multiple environments, or compliance requirements.
main ────────●────────────────●──────────── (production)
\ /
release/v2.1 ●────●──────● (stabilization)
/ \
develop ────●────●────●────●────●────────── (integration)
\ / \
feature/x ●──●──● \
\
feature/y ●──●──●# Start a feature
git checkout develop
git checkout -b feature/AUTH-123-add-sso
# Complete a feature — merge back to develop
git checkout develop
git merge --no-ff feature/AUTH-123-add-sso
git branch -d feature/AUTH-123-add-sso
# Create a release branch
git checkout develop
git checkout -b release/v2.1.0
# Finalize release
git checkout main
git merge --no-ff release/v2.1.0
git tag -a v2.1.0 -m "Release v2.1.0"
git checkout develop
git merge --no-ff release/v2.1.0
# Hotfix from production
git checkout main
git checkout -b hotfix/SEC-101-patch-xss
# ... fix applied ...
git checkout main
git merge --no-ff hotfix/SEC-101-patch-xss
git tag -a v2.1.1 -m "Hotfix v2.1.1"
git checkout develop
git merge --no-ff hotfix/SEC-101-patch-xssTrunk-Based Development (Continuous Delivery)
Best for: small teams, CI/CD pipelines, frequent deployments.
main ──●──●──●──●──●──●──●──●──●── (always deployable)
\ / \ / \ /
●─● ●─● ●─● (short-lived branches, <2 days)# Short-lived feature branch
git checkout main
git pull --rebase origin main
git checkout -b feature/add-search
# Keep branch fresh (daily)
git fetch origin
git rebase origin/main
# Merge back quickly (within 1-2 days)
git checkout main
git merge --no-ff feature/add-search
git push origin mainKey rules for trunk-based:
- Branches live less than 2 days
- Feature flags for incomplete work
- Main is always deployable
- No long-lived branches except main
Merge vs Rebase Decision
# REBASE: Use for local branch cleanup before merging
# Produces linear history, easier to read
git checkout feature/my-work
git rebase main
git checkout main
git merge --no-ff feature/my-work
# MERGE: Use for integrating shared/public branches
# Preserves full history and merge points
git checkout main
git merge --no-ff feature/my-work
# SQUASH MERGE: Use for PRs with messy intermediate commits
# Produces single clean commit on target branch
git checkout main
git merge --squash feature/my-work
git commit -m "feat: add search functionality"| Strategy | When to Use | Trade-off |
| Merge | Shared branches, preserving history | Noisy log, but full context |
| Rebase | Local cleanup, linear history | Clean log, rewrites history |
| Squash | Messy PR history, single logical unit | Cleanest log, loses details |
Golden rule: Never rebase commits that have been pushed to a shared branch.
Anti-Patterns
What NOT to Do
- Long-lived feature branches: Branches open for weeks accumulate merge conflicts and drift from main. Keep branches short-lived.
- Committing directly to main: Even solo developers benefit from branch-based workflow for rollback safety.
- Rebasing shared branches: Rewriting history on branches others work on causes lost commits and confusion.
- Inconsistent naming: Mixing
feature/,feat/,Feature/, and no prefix makes automation and filtering impossible. - No branch protection: Main/develop should require PR reviews and CI checks. Never force-push to protected branches.
# BAD: Direct commit to main
git checkout main
git commit -m "feat: add new feature"
git push
# BAD: Rebase a shared branch
git checkout develop
git rebase main # Others are also working on develop!
# GOOD: Feature branch with PR
git checkout -b feature/add-search
# ... work ...
# Open PR, get review, merge via PRQuick Reference
Branch Naming:
feature/<ticket>-<description>
fix/<ticket>-<description>
hotfix/<ticket>-<description>
release/v<semver>
chore/<ticket>-<description>
Strategy Selection:
Scheduled releases + multiple envs -> Git Flow
Continuous delivery + small team -> Trunk-based
Open source + many contributors -> GitHub Flow (fork + PR)
Merge Strategy:
Local cleanup -> rebase then merge --no-ff
Shared branch -> merge --no-ff (never rebase)
Messy PR commits -> squash merge
Rules:
- Never rebase public/shared branches
- Never force-push to main or develop
- Keep feature branches under 2 days (trunk-based)
- Always use --no-ff for merge commits (preserves branch history)
- Delete branches after mergingDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

