GitHub Workflow
Overview
This document describes how to effectively collaborate on the pyicub
project using GitHub. Our team uses a trunk-based development approach. This means that all work is centered around a single primary branch: master
. All new code is merged into this branch through short-lived, goal-oriented branches.
This document is written to help developers understand how to contribute safely and effectively.
Branching Strategy
We use a simple and scalable branching strategy:
Branch Name | Protected? | Base Branch | Description |
---|---|---|---|
master | YES | N/A | The main production branch. All stable code lives here. |
feature/* | NO | master | Short-lived branches for new features. Merged into master when ready. |
bugfix/* | NO | master | Short-lived branches for small fixes. Merged into master . |
v1.x | YES | master | Long-term release branches for major or divergent versions of the library. |
Key Points:
master
is the trunk: All production-ready code goes here.feature/*
branches are created to develop isolated features. They are merged intomaster
once completed and reviewed.bugfix/*
branches are used for fixing specific bugs and are merged intomaster
with the corresponding version bump (usually PATCH).vX.Y
branches are created when major changes require a divergence (e.g., a move fromicubSim
togazebo
). These branches are independently maintained and versioned.
Typical Development Workflow
-
Start from master
git checkout master
git pull origin master -
Create your feature or bugfix branch
git checkout -b feature/my-new-feature
-
Make your changes locally
-
Commit regularly with meaningful messages
git commit -m "feat: add new grasp controller"
We encourage using Conventional Commits where possible:
feat:
for new featuresfix:
for bug fixesdocs:
for documentationrefactor:
for internal refactoring without behavior change
-
Push your branch and open a pull request (PR)
git push origin feature/my-new-feature
- Open the PR from GitHub.
- Clearly describe what the PR does.
- Link to any related issues.
- Assign reviewers.
-
Get the code reviewed and approved
- Every Pull Request must be reviewed by at least one team member.
- Ensure all tests pass (local and CI checks).
-
Merge into master
- Once approved and tested, merge the PR into
master
.
- Once approved and tested, merge the PR into
Hotfixes
If an urgent bug is discovered in production:
-
Create a bugfix branch from
master
:git checkout master
git pull origin master
git checkout -b bugfix/fix-title-error -
Apply and commit the fix, then merge into
master
. -
Bump the PATCH version and tag the release.
For how to tag releases and version properly, refer to the Tagging Releases section in
Releases.md
. -
If the bug also affects an older version (e.g.,
v0.3
), cherry-pick the fix into that version branch.
Versioning and Tags
Our project follows Semantic Versioning with practical adaptations during early development (v0.x.y
). For guidance on when to bump versions and how to tag them correctly, refer to the Versioning Strategy and Tagging Releases sections in Releases.md
.
Best Practices
- One task per branch: keep changes isolated and easy to review.
- Use clear, descriptive branch and commit names.
- Never push to
master
directly — always use PRs. - Keep branches up to date with
master
to avoid conflicts. - Delete merged branches to keep the repository clean.