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-rotationgit 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 pushThis 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 figuresDraft methods section for experiment 2Update 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:
- Pull latest changes:
git pull. - Create a branch for today’s work:
git switch -c figure-redesign. - Work on scripts, models, manuscript, etc. Commit periodically.
- Merge back into
mainand push.
At the end of a major milestone (e.g. manuscript submission), tag it:
git tag submission-v1
git push --tagsTags mark important versions such as poster drafts or submissions.