Git Branching
Intro
Choose a branching strategy from the repository's delivery cadence,
supported versions, deployment environments, and release controls. Then
write a small branch contract that makes integration and tagging authority
unambiguous.
Overview
Select a strategy
Answer these questions before naming branches:
- Is
main continuously deployable, or is there a separate release gate?
- Are older versions supported while new major work continues?
- Do environments promote the same commit through test and production?
- Can incomplete work be hidden with feature flags?
- Is the team able to keep shared branches continuously integrated?
Use the smallest model that meets those constraints.
| Strategy |
Best fit |
Long-lived branches |
Release authority |
| Feature Branch Workflow |
Shared integration branch, periodic releases |
integration branch |
integration or release branch |
| GitHub Flow |
Frequent deployment and one supported production line |
main |
main |
| Trunk-Based Development |
Strong CI, feature flags, rapid integration |
main; optional short release branch |
main or just-in-time release branch |
| Gitflow |
Scheduled releases and formal stabilization |
main, develop, temporary release branches |
release branch |
| GitLab Flow |
Environment promotion or maintained stable lines |
main, environment or stable branches |
production or stable branch |
| Version-line integration |
Concurrent major lines or long-lived maintenance |
one dev and release branch per line |
designated line release branch |
Read strategy catalog before choosing a model
with release branches, multiple environments, or concurrent version lines.
Write the branch contract
For each protected long-lived branch, record:
- purpose and allowed changes;
- source branches and merge direction;
- tag authority and release validation command;
- hotfix and backport path;
- required checks, review, force-push, and deletion policy.
Keep task branches short-lived and name them according to git-workflow.
Use merge commits for meaningful integration between long-lived branches;
use the repository's chosen merge method for task branches.
Apply the version-line integration model
Use this model when v0 maintenance and v1 development, or any two supported
major lines, must progress independently:
line.x-dev -> line.x-release -> tag stable release -> main
next.x-dev -> next.x-pre-release -> tag alpha/beta/rc
-> next.x-release -> tag GA -> main
- Create
line.x-release from the latest stable tag and line.x-dev from
that release branch.
- Merge development into the release branch, validate there, and tag only
there. Merge the tagged stable release into
main immediately afterwards.
- For prereleases, merge development into
next.x-pre-release and tag only
on that branch. Create next.x-release only for general availability.
- Hotfix from the latest stable tag, then merge to the release branch, tag,
merge to
main, and merge back to the development branch.
Gotchas
- Treating
main as both active development and release authority.
This makes concurrent version lines indistinguishable. State whether
main is trunk or published history before creating branches.
- Copying Gitflow mechanically. Gitflow's
develop and release branches
add synchronization cost. Choose it only when scheduled stabilization or
parallel release preparation needs that cost.
- Tagging a development branch. A development head may not have passed
integration checks. Tag only the contract's designated release branch.
- Using environment branches as feature integration branches. Environment
branches promote tested commits; they are not a substitute for a developer
integration target unless the contract explicitly says so.
- Forgetting the return path for hotfixes. A production fix that is not
merged back into active development will recur in the next release.
- Protecting a branch without defining how automation merges it. Check
required reviews, checks, merge queue, and allowed merge methods before
making the branch the only release path.
Full reference
Required output
Deliver a branch contract in this form:
Strategy:
Reason for fit:
Protected branches:
Merge directions:
Tag authority:
Hotfix and backport policy:
Required checks and release commands:
Migration steps and rollback point:
Do not migrate a live repository by renaming, deleting, or force-updating
branches until its existing tags, release consumers, and protection rules
have been inspected.
Anti-patterns
- A branch per person or indefinitely open feature branch. Prefer a
focused task branch and merge it promptly.
- A release branch for every routine deployment. If the product can
release directly from a healthy trunk, extra release branches add delay.
- One undocumented catch-all branch. A branch without a stated authority
eventually receives incompatible development, release, and hotfix changes.
Cross-references
- Strategy catalog
git-workflow — naming, commits, pull requests, and merge methods
release-semver — changelog, tags, publishing, and release verification
1---2name: git-branching3description: |4 Select, document, and evolve a Git branching strategy for a repository.5 Use when comparing Gitflow, GitHub Flow, trunk-based development,6 feature branches, release branches, or concurrent version lines.7metadata:8 source: https://skillmd.com/skills/projectious-work/git-branching9 processkit:10 apiVersion: processkit.projectious.work/v111 id: SKILL-git-branching12 version: "1.0.0"13 created: 2026-07-21T19:05:00Z14 category: engineering15 layer: null16 uses:17 - skill: git-workflow18 purpose: "Apply the chosen strategy through branch names, commits, pull requests, and merge methods."19 - skill: release-semver20 purpose: "Prepare, tag, publish, and verify releases on the strategy's designated release branch."21 provides:22 processes: [branching-strategy-selection]23---2425# Git Branching2627## Intro2829Choose a branching strategy from the repository's delivery cadence,30supported versions, deployment environments, and release controls. Then31write a small branch contract that makes integration and tagging authority32unambiguous.3334## Overview3536### Select a strategy3738Answer these questions before naming branches:39401. Is `main` continuously deployable, or is there a separate release gate?412. Are older versions supported while new major work continues?423. Do environments promote the same commit through test and production?434. Can incomplete work be hidden with feature flags?445. Is the team able to keep shared branches continuously integrated?4546Use the smallest model that meets those constraints.4748| Strategy | Best fit | Long-lived branches | Release authority |49| --- | --- | --- | --- |50| Feature Branch Workflow | Shared integration branch, periodic releases | integration branch | integration or release branch |51| GitHub Flow | Frequent deployment and one supported production line | `main` | `main` |52| Trunk-Based Development | Strong CI, feature flags, rapid integration | `main`; optional short release branch | `main` or just-in-time release branch |53| Gitflow | Scheduled releases and formal stabilization | `main`, `develop`, temporary release branches | release branch |54| GitLab Flow | Environment promotion or maintained stable lines | `main`, environment or stable branches | production or stable branch |55| Version-line integration | Concurrent major lines or long-lived maintenance | one dev and release branch per line | designated line release branch |5657Read [strategy catalog](references/strategies.md) before choosing a model58with release branches, multiple environments, or concurrent version lines.5960### Write the branch contract6162For each protected long-lived branch, record:6364- purpose and allowed changes;65- source branches and merge direction;66- tag authority and release validation command;67- hotfix and backport path;68- required checks, review, force-push, and deletion policy.6970Keep task branches short-lived and name them according to `git-workflow`.71Use merge commits for meaningful integration between long-lived branches;72use the repository's chosen merge method for task branches.7374### Apply the version-line integration model7576Use this model when v0 maintenance and v1 development, or any two supported77major lines, must progress independently:7879```text80line.x-dev -> line.x-release -> tag stable release -> main8182next.x-dev -> next.x-pre-release -> tag alpha/beta/rc83 -> next.x-release -> tag GA -> main84```8586- Create `line.x-release` from the latest stable tag and `line.x-dev` from87 that release branch.88- Merge development into the release branch, validate there, and tag only89 there. Merge the tagged stable release into `main` immediately afterwards.90- For prereleases, merge development into `next.x-pre-release` and tag only91 on that branch. Create `next.x-release` only for general availability.92- Hotfix from the latest stable tag, then merge to the release branch, tag,93 merge to `main`, and merge back to the development branch.9495## Gotchas9697- **Treating `main` as both active development and release authority.**98 This makes concurrent version lines indistinguishable. State whether99 `main` is trunk or published history before creating branches.100- **Copying Gitflow mechanically.** Gitflow's `develop` and release branches101 add synchronization cost. Choose it only when scheduled stabilization or102 parallel release preparation needs that cost.103- **Tagging a development branch.** A development head may not have passed104 integration checks. Tag only the contract's designated release branch.105- **Using environment branches as feature integration branches.** Environment106 branches promote tested commits; they are not a substitute for a developer107 integration target unless the contract explicitly says so.108- **Forgetting the return path for hotfixes.** A production fix that is not109 merged back into active development will recur in the next release.110- **Protecting a branch without defining how automation merges it.** Check111 required reviews, checks, merge queue, and allowed merge methods before112 making the branch the only release path.113114## Full reference115116### Required output117118Deliver a branch contract in this form:119120```text121Strategy:122Reason for fit:123Protected branches:124Merge directions:125Tag authority:126Hotfix and backport policy:127Required checks and release commands:128Migration steps and rollback point:129```130131Do not migrate a live repository by renaming, deleting, or force-updating132branches until its existing tags, release consumers, and protection rules133have been inspected.134135### Anti-patterns136137- **A branch per person or indefinitely open feature branch.** Prefer a138 focused task branch and merge it promptly.139- **A release branch for every routine deployment.** If the product can140 release directly from a healthy trunk, extra release branches add delay.141- **One undocumented catch-all branch.** A branch without a stated authority142 eventually receives incompatible development, release, and hotfix changes.143144### Cross-references145146- [Strategy catalog](references/strategies.md)147- `git-workflow` — naming, commits, pull requests, and merge methods148- `release-semver` — changelog, tags, publishing, and release verification