PrimebrickPrimebrick
  • Primebrick.dev
  • GitHub
  • Documentation
  • Services
  • Libraries
  • API Catalog
Resources
  • Landing Page
  • API Catalog
  • GitHub
PrimebrickPrimebrick

© 2026 Primebrick. MIT License.

github
DAL Library
    AI Agent Rules and SkillsAudit and Soft-Delete SubsystemsAudit Port and Delta TrackingAuditable Joins and Display NamesBulk OperationsCI/CD and Release ProcessConnection Pool and Session ConfigurationCore ArchitectureDal GatewayEntity Metadata SystemError HandlingGetting StartedGitFlow and Branching RulesGlossaryKey Design DecisionsOverviewQuery DSL and SQL BuilderRead OperationsRepository: CRUD and FindersStreaming Large Result SetsTest Infrastructure and EntitiesTest Suite CoverageTestingTimeout Management and withClientType Coercion: JS ↔ PostgreSQLWrite OperationsREADME
SDK Library
powered by Zudoku
DAL Library

GitFlow and Branching Rules

GitFlow and Branching Rules

Relevant source files

The following files were used as context for generating this wiki page:

  • .devin/rules/workflow.md
  • docs/gitflow.md

This page outlines the mandatory GitFlow procedures for the @primebrick/dal-pg repository. These rules apply to both human contributors and AI agents to ensure codebase stability, consistent versioning, and clean repository history.

Purpose and Scope

The branching strategy is designed to isolate development work, manage releases, and facilitate rapid hotfixing while maintaining a pristine main branch. It strictly enforces the "No v prefix" convention and requires explicit version synchronization within package.json prior to merging.

Branch Naming Conventions

All work must be performed in dedicated branches. Direct commits to develop or main are strictly prohibited docs/gitflow.md:18-18.

Branch TypeSource BranchNaming PatternPurpose
Featuredevelopfeature/<slug>New functionality or refactoring. Slugs must be lowercase kebab-case docs/gitflow.md:19-19, 105-105.
Releasedeveloprelease/<version>Preparing a new production release. Increments MINOR version docs/gitflow.md:20-20, 82-82.
Hotfixmainhotfix/<version>Urgent production bug fixes. Increments PATCH version docs/gitflow.md:21-21, 81-81.

Versioning Rules

  • No 'v' Prefix: Do not use v in branch names (e.g., use release/0.13.2, not release/v0.13.2) docs/gitflow.md:78-78.
  • Tagging: Git tags must match the version exactly without a prefix (e.g., 0.13.2) docs/gitflow.md:79-80.

Branch Lifecycle and Data Flow

The following diagram illustrates the flow of code between branches and the synchronization requirements.

GitFlow State Transition

Code
graph TD Main["branch: main"] Develop["branch: develop"] Feature["branch: feature/&lt;slug&gt;"] Release["branch: release/&lt;version&gt;"] Hotfix["branch: hotfix/&lt;version&gt;"] Develop -- "checkout -b" --> Feature Feature -- "merge --no-ff" --> Develop Develop -- "checkout -b" --> Release Release -- "version bump commit" --> Release Release -- "merge --no-ff" --> Main Main -- "merge back" --> Develop Main -- "checkout -b" --> Hotfix Hotfix -- "version bump commit" --> Hotfix Hotfix -- "merge --no-ff" --> Main Main -- "merge back" --> Develop

Sources: docs/gitflow.md:16-21, docs/gitflow.md:31-45

Mandatory Closing Procedure

When a task is complete, branches must be closed using a non-fast-forward merge to preserve the group of commits as a single logical unit.

  1. Merge to Base: Use git merge --no-ff <branch-name> into the appropriate base branch (develop for features, main for release/hotfix) docs/gitflow.md:33-36.
  2. Push Base: Execute git push origin <base-branch> docs/gitflow.md:38-38.
  3. Local Cleanup: Delete the branch locally using git branch -d <branch-name> docs/gitflow.md:40-40.
  4. Remote Cleanup: Delete the branch on the origin using git push origin --delete <branch-name> docs/gitflow.md:42-42.
  5. Alignment: For Release and Hotfix branches, main must be merged back into develop to ensure develop contains the latest version bumps and fixes docs/gitflow.md:44-44.

Version Synchronization

The package.json version is the source of truth for CI/CD. The version must be updated and committed on the release/ or hotfix/ branch before merging to main docs/gitflow.md:48-50.

The version-sync.mjs Utility

The repository includes a script scripts/version-sync.mjs that manages this process docs/gitflow.md:66-72.

  • It detects the branch type and calculates the expected version from git tags.
  • It is triggered automatically via the prebuild hook during pnpm run build docs/gitflow.md:68-68.
  • Manual Trigger: Use pnpm run version:auto to sync the package.json before committing docs/gitflow.md:54-54.

Correct Release Sequence

StepCommand / ActionPurpose
1git checkout -b release/0.2.0Create release branch from develop
2pnpm run version:autoRun version-sync.mjs to update package.json
3git add package.json && git commit -m "bump version to 0.2.0"CRITICAL: Commit version before merge
4git checkout main && git merge --no-ff release/0.2.0Merge to production
5git tag 0.2.0Create immutable version tag
6git push origin main --tagsTrigger CI for deployment

Sources: docs/gitflow.md:52-62

Rules for AI Agents

AI agents (e.g., Devin) are subject to additional constraints to prevent unauthorized or accidental modifications.

  1. Tic-Toc Planning: Agents must generate a plan in ai-plans/ and wait for a "PROCEED" instruction before any code modification .devin/rules/workflow.md:4-15.
  2. Explicit Commit Permission: Agents MUST NEVER commit changes without explicit user instruction (e.g., "procedi con il commit") docs/gitflow.md:7-14.
  3. Branching: Agents must infer a branch slug and ensure they are on a feature/ branch before the first tracked-file change docs/gitflow.md:101-108.

Common Mistakes to Avoid

  • ❌ Committing directly on develop or main docs/gitflow.md:86-86.
  • ❌ Forgetting to delete branches (both local and origin) after merge docs/gitflow.md:88-88.
  • ❌ Using 'v' prefix in tags or branch names docs/gitflow.md:89-89.
  • ❌ Merging to main without committing the package.json version bump first docs/gitflow.md:92-92.
  • ❌ Creating commits before the feature branch has been created docs/gitflow.md:87-87.

Sources: docs/gitflow.md:84-92


Last modified on July 13, 2026
Getting StartedGlossary
On this page
  • Purpose and Scope
  • Branch Naming Conventions
    • Versioning Rules
  • Branch Lifecycle and Data Flow
    • GitFlow State Transition
  • Mandatory Closing Procedure
  • Version Synchronization
    • The version-sync.mjs Utility
    • Correct Release Sequence
  • Rules for AI Agents
  • Common Mistakes to Avoid