Guidelines for contributing to Granite Switch.
- Fork the repository
- Create a branch:
git checkout -b feature/your-feature - Make changes and commit
- Push and open a Pull Request
main: Stable branch, always ready for release- Feature branches:
feature/short-description - Bugfix branches:
bugfix/short-description
# 1. Create branch from main
git checkout main
git pull origin main
git checkout -b feature/your-feature
# 2. Make changes and commit (-s adds your DCO sign-off)
git add <files>
git commit -s -m "Add feature X"
# 3. Keep up-to-date with main
git fetch origin
git rebase origin/main
# 4. Push and create PR
git push origin feature/your-featureWrite clear commit messages that explain what changed and why:
Short summary (50 chars or less)
Longer explanation if needed. Explain what changed and why,
not how (the diff shows how).
Fixes #123
Good examples:
- "Fix batch indexing for variable sequence lengths"
- "Add serialization roundtrip test"
- "Update supported models documentation"
Avoid:
- "fix bug" (what bug?)
- "update code" (what changed?)
- "WIP" (squash before merging)
Every commit must carry a Signed-off-by: trailer to certify you agree to the
Developer Certificate of Origin. The DCO check
blocks any PR containing an unsigned (non-merge) commit.
# Sign off a single commit as you make it
git commit -s -m "Your commit message"
# Sign off every commit on an existing branch
git rebase --signoff origin/mainThe pre-commit hooks add and verify the sign-off for you automatically once installed. See CICD.md for the full hook and CI setup.
Before committing:
- Run tests:
uv run pytest tests/ -v - Check comments match code — stale comments are worse than no comments
- Update docs if behavior changed
- Target the
mainbranch - Include a clear description of changes
- Reference related issues
- Ensure tests pass
Open an issue or start a discussion.