Git Workflow#
This document describes the Git workflow used in the Sigima project,
based on a main branch, a develop branch, and feature-specific branches.
It also defines how bug fixes are managed.
Note
This workflow is a simplified version of the Gitflow Workflow. It has been adapted to suit the needs of the Sigima project at the current stage of development. In the near future, we may consider adopting a more complex workflow, e.g. by adding release branches.
Branching Model#
Main Branches#
main: Represents the stable, production-ready version of the project.develop: Prepares the next release, i.e. a patch release (e.g., 1.0.1) as long as it only contains fixes since the last release, or a minor or major release (e.g., 1.1.0) once new features are merged.
Feature Branches#
feature/feature_name: Used for the development of new features.Created from
develop.Merged back into
developonce completed.Deleted after merging.
Release Branch#
release: Represents the current maintenance line for patch releases, whendevelopalready contains changes for the next minor or major release.Created from
mainonly when a patch release is needed whiledevelopcontains changes that must not be released yet.Accepts
fix/xxxandhotfix/xxxbranch merges.Merged back into
mainfor each patch release tag (e.g., 1.0.1, 1.0.2).Merged into
developafter each patch release, so that its fixes reachdevelopwithout cherry-picking.Deleted when the next minor or major version is released.
Note
The release branch is not versioned (no release/1.0.x), and it does not
always exist. Without release branch, develop prepares the next patch
release: fixes and patch releases are made from develop. When a new minor
version is released (e.g., 1.2.0), the release branch is deleted; a new one
is created from the fresh tag only if a patch for 1.2.1 is needed while
develop already contains changes for 1.3.0.
Bug Fix Branches#
fix/xxx: Used for general bug fixes that are not urgent.Created from
develop, or fromreleasewhen this branch exists and the fix must be in the next patch release.Merged back into the originating branch once completed.
Deleted after merging.
hotfix/xxx: Used for urgent production-critical fixes.Created from
release(if exists) ordevelop(if noreleasebranch).Merged back into
releaseordevelop.A fix merged into
releasereachesdevelopwhenreleaseis merged intodevelop.Deleted after merging.
Note
Hotfixes (high-priority fixes) will be integrated in the next patch release
(X.Y.Z -> Z+1). Fixes (low-priority fixes) will be integrated in the next
release prepared by develop: a patch release, or a feature release
(X.Y -> Y+1) once develop contains new features.
Documentation Branches#
When working on documentation that is not related to source code
(e.g. training materials, user guides), branches should be named
using the doc/ prefix.
Examples:
doc/training-materialsdoc/user-guide
This naming convention improves clarity by clearly separating documentation efforts from code-related development (features, fixes, etc.).
Commit Message Convention#
New commits and pull request titles should follow the Conventional Commits format:
<type>[optional scope]: <description>
Use the type that best describes the change:
featfor a new capability;fixfor a bug fix;testfor test-only changes;docsfor documentation;cifor continuous-integration configuration;refactorfor a behavior-preserving code change;chorefor maintenance work not covered above.
For example:
fix(roi): preserve inverse ROI rendering
test(viz): cover PlotPy ROI coordinates
ci: add Pylint quality gate
Merge commits and annotated release tags are exceptions: keep their explicit Git
messages, such as Merge branch 'feature/feature_name' and
Sigima v1.2.0. Do not rewrite published history solely to change old
messages.
Workflow for New Features#
Create a new feature branch from
develop:git checkout develop git checkout -b feature/feature_name
Develop the feature and commit changes.
Merge the feature branch back into
develop:git checkout develop git merge --no-ff feature/feature_name
Delete the feature branch:
git branch -d feature/feature_name
Warning
Do not leave feature branches unmerged for too long.
Regularly rebase them on develop to minimize conflicts.
Workflow for Regular Bug Fixes#
For the next release prepared by develop (target: develop):
Create a bug fix branch from
develop:git checkout develop git checkout -b fix/bug_description
Apply the fix and commit changes.
Merge the fix branch back into
develop:git checkout develop git merge --no-ff fix/bug_description
Delete the fix branch:
git branch -d fix/bug_description
For the next patch release, when a release branch exists (target: release):
Create a bug fix branch from
release:git checkout release git checkout -b fix/bug_description
Apply the fix and commit changes.
Merge the fix branch back into
release:git checkout release git merge --no-ff fix/bug_description
Delete the fix branch:
git branch -d fix/bug_description
Warning
Do not create a fix/xxx branch from a feature/feature_name branch.
Always branch from develop or release to ensure fixes are correctly propagated.
# Incorrect:
git checkout feature/feature_name
git checkout -b fix/wrong_branch
# Correct:
git checkout develop
git checkout -b fix/correct_branch
Workflow for Critical Hotfixes#
Create a hotfix branch from
release(ordevelopif noreleasebranch exists):git checkout release # or: git checkout develop git checkout -b hotfix/critical_bug
Apply the fix and commit changes.
Merge the fix back into
release(ordevelop):git checkout release # or: git checkout develop git merge --no-ff hotfix/critical_bug
If the fix was merged into
release, mergereleaseintodevelop, at the latest after the patch release:git checkout develop git merge --no-ff release
Delete the hotfix branch:
git branch -d hotfix/critical_bug
Warning
Do not merge fix/xxx or hotfix/xxx directly into main without following the workflow.
Ensure release is merged into develop to avoid losing fixes in future releases.
Workflow for Patch Releases#
When ready to release a patch version (e.g., 1.0.1, 1.0.2):
If no release branch exists, develop only contains fixes since the last release: release it with the workflow for minor/major releases below, using the patch version number. Otherwise, release the release branch:
Ensure the
releasebranch contains all desired fixes, as well as the version number and the release notes of the patch release (seeRELEASING.md).Merge
releaseintomain:git checkout main git merge --no-ff release
Tag the release on
mainand push the tag (-ssigns the tag, use-aotherwise):git push origin main git tag -s v1.0.1 -m "Sigima v1.0.1" git push origin v1.0.1
Pushing the tag starts the Release workflow, which checks the tag, runs the tests and builds the release files, then creates a draft GitHub release. Review the draft release and publish it: this uploads the package to PyPI. Never create a GitHub release by hand (see
RELEASING.mdat the root of the repository).Merge
releaseintodevelop, and keep thereleasebranch for additional patches in the same minor version series:git checkout develop git merge --no-ff release
Workflow for Minor/Major Releases#
When ready to release a new minor or major version (e.g., 1.1.0, 2.0.0):
Once
developcontains the version number and the release notes of the release (seeRELEASING.md), mergedevelopintomain:git checkout main git merge --no-ff develop
Tag the release on
mainand push the tag (-ssigns the tag, use-aotherwise):git push origin main git tag -s v1.1.0 -m "Sigima v1.1.0" git push origin v1.1.0
Pushing the tag starts the Release workflow, which checks the tag, runs the tests and builds the release files, then creates a draft GitHub release. Review the draft release and publish it: this uploads the package to PyPI. Never create a GitHub release by hand (see
RELEASING.mdat the root of the repository).Fast-forward
developto the releasedmaincommit:git checkout develop git merge --ff-only main git push origin develop
This makes the release merge commit, its conflict resolutions, and the tag reachable from
developwithout creating a redundant merge commit. If the fast-forward fails, stop and reconcilemainanddevelopthrough a reviewed merge; never rebase or force-push either shared branch.Delete the old
releasebranch (if exists):git branch -d release git push origin --delete release
Create a new
releasebranch frommainonly when a patch (e.g., 1.1.1) is needed whiledevelopalready contains changes for the next minor or major release:git checkout main git checkout -b release git push -u origin release
Best Practices#
Regularly rebase feature branches on
developto stay up to date:git checkout feature/feature_name git rebase develop
Avoid long-lived branches to minimize merge conflicts.
Merge
releaseintodevelopafter each patch release: fixes reachdevelopwithout cherry-picking.While
developprepares a patch release (noreleasebranch), keep changes for the next minor or major release in their branches until the patch release, or create thereleasebranch first.Clearly differentiate between
fix/xxx(non-urgent fixes) andhotfix/xxx(critical production fixes).When creating the
releasebranch, update release notes to indicate which version it targets (e.g., add a comment in the merge commit: “Create release branch for v1.0.x maintenance”).When it exists, the
releasebranch represents the current maintenance line. To know which version it targets, check the most recent tag onmainor the release notes.
Takeaway#
This workflow ensures a structured yet flexible development process while keeping
main stable and develop always updated with the latest changes.
When needed, the release branch provides a dedicated maintenance line for patch releases,
allowing develop to proceed with new features without interference. This solves
the problem of coordinating unreleased changes across the PlotPyStack ecosystem
(DataLab, Sigima, PlotPy, guidata, PythonQwt) by providing a stable branch for
CI testing during maintenance cycles.