Skip to Content
Recommended git workflow

Recommended git workflow

This is how we recommend building software for RAMMP. Several people across several organizations work on the same repos, and this workflow keeps that from producing integration bugs. It is designed so that:

  • main is always deployable. A new contribution never blocks testing of what already works.
  • Merge conflicts stay small. Branches are short-lived, and the latest dev is merged in before review.
  • The state of a repo is legible. Branch names carry the issue number, and every change arrives through a reviewed pull request.
  • Changes are tested before they land. The pull request records how.

RAMMP is a polyrepo, so this workflow applies within each repo you contribute to. Publishing a module covers how a module repo is built and shipped. This page covers how code gets from your branch into the repo.

Pre-commit hooks

Repos that enforce code style use pre-commit  to run formatters and linters before each commit: Ruff for Python, clang-format for C++, and general file hygiene. If the repo has a .pre-commit-config.yaml, run pre-commit install once after cloning. The hooks then run on every git commit.

With uv (recommended):

uv tool install pre-commit pre-commit install

Without uv:

pip install pre-commit pre-commit install

On first run, pre-commit downloads the hook environments, which takes about a minute. A failing hook blocks the commit and prints what to fix. Ruff and clang-format fix files in place; stage the changes and commit again.

Repo organization

Every repo has two long-lived branches and any number of short-lived ones.

BranchWhat it holdsHow it changes
mainTested, deployable code. Stable at all times.Locked. Updated from dev periodically, and by hotfixes.
devThe staging branch. Mostly stable.Pull requests from feature and bug branches.
feature/*, bug/*Your work in progress. Need not be stable.Forked from the latest dev. Merged back to dev by pull request when ready.

Some smaller repos have only main. There, follow the same workflow with main in place of dev.

Contributing code

Every feature and bug is an issue on the repo. If the work you are about to do has no issue, open one before starting.

Assign yourself to the issue on GitHub

This stops two people developing the same feature at once.

Pull the latest changes to your local repo

In the repo, confirm the working tree is clean with git status, then:

git checkout dev git pull

Create a feature branch

From the latest dev, create a branch for the feature:

git checkout -b feature/<ISSUE NUMBER>-<BRIEF-DESCRIPTION>

For a bug fix:

git checkout -b bug/<ISSUE NUMBER>-<BRIEF-DESCRIPTION>

The issue number is the number next to the issue title on GitHub. Keep the description short.

Develop and test

Commit and push to your branch as often as you like. It is yours until the pull request opens. Test on the hardware or in simulation, whichever applies, before you ask for review.

Open a pull request

Merge the latest dev into your branch first, so any conflicts are resolved before review:

git checkout dev git pull origin dev git checkout <YOUR FEATURE BRANCH> git merge dev

Push the branch:

git push origin <YOUR FEATURE BRANCH>

On GitHub, open a pull request from your branch to dev. If the repo has a PR template, fill it in: what changed, how you tested it, and what you observed. Closes #<ISSUE NUMBER> in the description links the PR to the issue and closes it on merge. Assign a reviewer.

Merge the pull request

After approval, merge with Squash and Merge, so dev gets one commit per feature rather than every intermediate commit. Then check out dev locally and pull before starting the next feature.

Hotfixes

A hotfix is for a critical bug on main that cannot wait for the next promotion from dev, usually because dev is unstable or carries unfinished work.

Branch off main

git checkout main git pull origin main git checkout -b hotfix/<BRIEF-DESCRIPTION>

Fix and test

Confirm it fixes the problem without breaking anything else on main.

Merge to main

Open a PR directly to main. After it merges, deploy to the robot.

Back-port to dev

Merge the hotfix branch, or main, into dev straight away. Otherwise the bug returns with the next promotion.

FAQ

Do I lose my history with Squash and Merge?

No. The dev log shows one commit per feature, and the pull request on GitHub keeps every commit and comment from the branch.

Next

Edit this page on GitHub