Skip to content

Branching strategy

This page sets the rules for branches in ConnectSoft repositories and in services generated from ConnectSoft templates. It is written for engineers and AI agents that change code in these repositories.

ConnectSoft uses trunk-based development: - every repository has one long-lived branch, the default branch; - changes arrive on it through short-lived branches and pull requests; - every build of the default branch is a release, as described in Versioning and release.

There are no develop, release or long-lived hotfix branches. No ConnectSoft repository uses them.

Rules

CS-GIT-001: The default branch is master or main

Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active

Why

Both names are in use: most repositories use master and a few use main. Renaming a default branch breaks pipeline triggers, submodule references and open pull requests, and gains nothing.

Do

  • Treat master and main as the same thing. The standards say "default branch" for either.
  • When a pipeline or script needs the branch name, read it from the repository, or accept both names.

Don't

  • Rename the default branch of an existing repository.
  • Add a second long-lived branch such as develop.

How to check

  • The repository has one long-lived branch.
  • Pipeline triggers and publish conditions name the branch the repository actually uses.

CS-GIT-002: Only the repository owner commits directly to the default branch

Severity: major · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual (target: ENF-023) · Status: active

Why

A pull request is the only point where a change is reviewed, checked against these standards and linked to a work item. A direct commit skips all of that. The repository owner keeps the right to commit directly for urgent or trivial changes, but normally uses pull requests too.

Do

  • Contributors and AI agents push to a change branch and open a pull request into the default branch.
  • The repository owner merges the pull request after review, as described in Code review.

Don't

  • Push to the default branch as a contributor or as an AI agent.
  • Let an AI agent commit, push or merge unless the owner asked for that action in the current task.

How to check

  • Commits on the default branch are merge commits of pull requests, or are authored by the repository owner.
  • Branch policies, where configured, require a pull request for everyone except the owner.

CS-GIT-003: Use short-lived change branches named by kind and work item

Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active

Why

A short-lived branch merges cleanly and is reviewed while the context is fresh. A name that carries the work item and a short description shows what the branch is for without opening it.

Do

  • Name the branch <kind>/<work-item-id>-<short-description> in lowercase with hyphens. For example: feature/4339-shell-preference-bridge or fix/4412-null-order-date.
  • Use feature/ for new behaviour and fix/ for defects. Leave out the work item ID when there is none, as in fix/null-order-date.
  • Create the branch from the current default branch and merge it within days.
  • Delete the branch after the pull request is merged.

Don't

  • Keep a branch open for weeks.
  • Merge the default branch into a change branch repeatedly to keep a long branch alive. Split the work into smaller pull requests instead.

Example

git switch master
git pull
git switch -c feature/4339-shell-preference-bridge

How to check

  • The source branch of the pull request follows the naming pattern.
  • The branch was created from a recent default branch.

Generated changes

Changes produced by an AI agent or by a template run follow the same rules: - they arrive on a change branch through a pull request; - they are reviewed like any other change.

To add hand-written code to a generated change, create your own branch from the generated branch. Do not commit on top of it. This keeps the generated output reproducible.