3  Branch and Commit Workflow

4 Branching

Use a stable main branch for reproducible, working code and manuscript.
Create short‑lived feature branches for specific tasks such as new analyses, figure revisions, or manuscript edits:

  • git switch -c pca-rotation
  • git switch -c manuscript-intro-edits

When the task is complete, merge it back to main:

git add .
git commit -m "Improve PCA labelling"
git switch main
git merge pca-rotation
git push

This keeps experimental changes isolated and the main branch clean.

5 Commit Messages

Make commits frequent and descriptive. Good commit messages answer what changed and why:

  • Refactor plotting helpers for PCA figures
  • Draft methods section for experiment 2
  • Update power simulation script

Avoid vague messages like stuff or updates.
Small, topical commits make it easier to revert changes and understand project history.

6 Daily Routine

A simple daily workflow looks like this:

  1. Pull latest changes: git pull.
  2. Create a branch for today’s work: git switch -c figure-redesign.
  3. Work on scripts, models, manuscript, etc. Commit periodically.
  4. Merge back into main and push.

At the end of a major milestone (e.g. manuscript submission), tag it:

git tag submission-v1
git push --tags

Tags mark important versions such as poster drafts or submissions.