Branching & PR Conventions
This document outlines the branching strategy, pull request workflow, and contribution guidelines for MiningOS repositories.
For development environment setup, see Contribution Workflow. For repository organization, see Repository Structure.
Branching Strategy
MiningOS follows a simplified Git Flow model with main as the single permanent branch.
Branch Paradigm
main
Production-ready, deployed code
feature/*, fix/*, hotfix/*
—
Branch Types
main
main
Production-ready code
Permanent
feature
feature/<description>
New functionality
Temporary
fix
fix/<description>
Bug fixes
Temporary
hotfix
hotfix/<description>
Critical production fixes
Temporary
docs
docs/<description>
Documentation updates
Temporary
refactor
refactor/<description>
Code restructuring
Temporary
Branch Naming Conventions
Use lowercase with hyphens for readability:
For naming conventions in code, see Contribution Workflow — Naming Conventions.
Branch Lifecycle
Diagram Explanation:
Feature and fix branches are created from
mainCompleted work merges back into
mainafter PR approvalmainrepresents production-ready code at all timesReleases are tagged directly on
mainafter significant merges
Repository Setup
MiningOS uses a fork-based workflow with upstream remotes for synchronization with parent repositories. For the repository hierarchy, see Repository Structure — Repository Hierarchy.
Initial Setup
Upstream Synchronization
Keep your fork synchronized with upstream changes:
A convenience script (upstream-merge.sh) is provided in most repositories:
For directory structure including this script, see Repository Structure — Standard Directory Structure.
Creating a Feature Branch
Workflow
Commit Message Conventions
MiningOS follows Conventional Commits specification.
Commit Format
Commit Types
feat
New feature
feat(rpc): add getThingStats method
fix
Bug fix
fix(modbus): resolve connection timeout
docs
Documentation
docs(readme): update installation steps
style
Code style (formatting)
style: fix indentation in worker.js
refactor
Code restructuring
refactor(stats): simplify aggregation logic
perf
Performance improvement
perf(rtd): batch RTD writes to Hyperbee
test
Adding/fixing tests
test(rpc): add unit tests for listThings
chore
Maintenance tasks
chore: update dependencies
Scope Examples
Scope should reflect the component or module affected:
Commit Examples
Pull Request Workflow
Before Creating a PR
Run linting (see Testing Guidelines — Linting):
Run tests (see Testing Guidelines):
Rebase on latest main — incorporate changes from main (conflicts may ensue):
Squash commits — condense branch into shorter sequence of larger commits:
PR Title Format
Follow the same convention as commits:
Examples:
feat(rpc): add getContainerStats methodfix(worker): resolve memory leak in RTD collectiondocs(api): document all RPC methods
PR Description Template
For code style guidelines, see Contribution Workflow — Code Standards. For documentation requirements, see Code Documentation Standards.
PR Review Process
Automated Checks: Ensure linting and tests pass
Code Review: At least one approval required
Address Feedback: Resolve all review comments
Squash and Merge: Maintain clean commit history
Handling Upstream Inheritance
MiningOS workers inherit from base classes across repositories (see Repository Structure — Repository Hierarchy). When changes are needed in a parent repository:
Create PR in parent repo first
Wait for merge and release
Update dependency in child repo:
Test integration in child repo (see Testing Guidelines — Test Inheritance)
Create PR in child repo referencing parent changes
For creating new workers in the hierarchy, see Adding New Worker Type.
Release Process
Release Workflow
Releases are created by merging feature/fix branches into main and tagging, as described in the steps below:
Process steps:
Contributor creates feature/fix branch from
mainContributor runs tests on the branch
If tests fail, Contributor fixes issues and returns to step 2
Contributor creates Pull Request targeting
mainReviewer performs code review
If changes requested, Contributor addresses feedback, pushes fixes, and returns to step 2
If rejected, Reviewer closes PR and process ends
If approved, Reviewer merges branch into
mainReviewer tags the release with version number (if applicable)
Reviewer deploys to production
If deployment fails, Reviewer rolls back to previous tag and returns to step 3
Process ends successfully
The BPMN diagram below illustrates the workflow:
Version Tagging
Versioning
MiningOS follows Semantic Versioning:
MAJOR (1.x.x): Breaking API changes
MINOR (x.1.x): New features, backward compatible
PATCH (x.x.1): Bug fixes, backward compatible
Quick Reference
Common Git Commands
PR Checklist
Last updated