PyPTO Git Commit Workflow
Prerequisites
⚠️ ALWAYS run these agents first (IN PARALLEL):
- •
code-reviewer- Review code quality - •
testing- Verify build and tests pass
Launch both simultaneously to save time.
Workflow
- •Launch code-review and testing agents in parallel
- •Wait for both to complete
- •Address any issues found
- •Stage changes
- •Generate commit message
- •Commit and verify
Stage Changes
Related changes together:
git add path/to/file1.cpp path/to/file2.h git diff --staged # Review
Cross-layer pattern (C++ + Python + Type stubs + Tests):
git add include/pypto/ir/expr.h python/bindings/ir_binding.cpp \
python/pypto/pypto_core/__init__.pyi tests/ut/ir/test_expr.py
Never stage: Build artifacts (build/, *.o), temp files, IDE configs
Commit Message Format
Structure: type(scope): description (≤72 chars)
Types: feat, fix, refactor, test, docs, style, chore, perf Scope: Module/component (ir, printer, builder) Description: Present tense, action verb, no period
Good examples:
feat(ir): Add unique identifier field to MemRef fix(printer): Update printer to use yield_ instead of yield refactor(builder): Simplify tensor construction logic test(ir): Add edge case coverage for structural comparison
Bad examples (avoid):
❌ feat(ir): Added feature. # Past tense, has period ❌ Fix bug # Missing type prefix ❌ WIP # Not descriptive
Commit
# Short message git commit -m "feat(ir): Add tensor rank validation" # Detailed message (in editor) git commit
In editor:
feat(ir): Add tensor rank validation Validates tensor rank is positive before setting shape. Raises ValueError for invalid ranks. Updates tests with edge case coverage.
Co-Author Policy
❌ NEVER add AI assistants: No Claude, ChatGPT, Cursor AI, etc.
✅ Only credit human contributors: Co-authored-by: Name <email>
Why? AI tools are not collaborators. Commits reflect human authorship.
Post-Commit Verification
git show HEAD # View commit git log -1 # Check message git show HEAD --name-only # Verify files
Fix issues (only if not pushed):
git commit --amend -m "Corrected message" # Fix message git add file && git commit --amend --no-edit # Add forgotten file
⚠️ Only amend unpushed commits!
Checklist
- • Code review completed
- • Tests passed
- • Only relevant files staged
- • No build artifacts
- • Message format:
type(scope): description(≤72 chars, present tense, no period) - • No AI co-authors
Remember
A good commit is thoroughly reviewed, groups related changes, has clear "why" message, and attributes only human authors.