| name | git-workflow-guide |
| description | Git workflow standards including commit message format, PR process, branch management, and feature implementation workflow with TDD and code review integration. Use when committing code, creating PRs, managing branches, or when asked about Git conventions, version control, commit standards, or pull request workflow. |
Git Workflow Guide
Complete Git workflow standards for professional development with integrated TDD and code review.
Quick Reference
Commit Message Format
<type>: <description>
<optional body>
Types
- feat: New feature
- fix: Bug fix
- refactor: Code refactoring (no functionality change)
- docs: Documentation updates
- test: Test-related changes
- chore: Build process or auxiliary tool changes
- perf: Performance optimization
- ci: CI/CD configuration changes
Examples
feat: add user authentication feature
fix: resolve sidebar display issue
refactor: restructure API response handling logic
docs: update README installation instructions
update code
fix bug
changes
Rules
- Use present tense: "add feature" not "added feature"
- Lowercase first letter
- No period at the end
- Keep description concise (≤50 characters)
- Body is optional for detailed explanation
Pull Request Workflow
Pre-PR Checklist
-
Analyze Complete Commit History
git log --oneline
-
Review All Changes
git diff main...HEAD
git diff --stat main...HEAD
-
Ensure Tests Pass
npm run test
npm run build
npm run lint
PR Creation Steps
-
Push Branch (use -u flag for new branches)
git push -u origin feature/your-feature-name
-
Write Detailed PR Summary
- Explain purpose and background of changes
- List main change points
- Include related issue links
-
Include Test Plan
## Test Plan
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing complete
- [ ] Browser compatibility tested
-
Add TODOs (if any)
## TODOs
- [ ] Add more edge case tests
- [ ] Update related documentation
- [ ] Performance optimization
PR Review Standards
Follow Code Quality Power's code-review.md for systematic review:
- Security check (CRITICAL)
- Logic correctness (HIGH)
- Error handling (HIGH)
- Test coverage (HIGH)
- Code quality (MEDIUM)
Feature Implementation Workflow
1. Plan First
Use Development Workflow Power's planner
Steps:
1. Read planner.md steering file
2. Create implementation plan
3. Identify dependencies and risks
4. Break down into multiple phases
Output: Detailed implementation plan document
2. TDD Methodology
Use Development Workflow Power's tdd-guide
TDD Cycle:
1. Write test (RED) - Test should fail
2. Implement feature (GREEN) - Make test pass
3. Refactor (REFACTOR) - Improve code quality
4. Verify coverage (VERIFY) - Ensure 80%+ coverage
Reference: See testing standards in testing steering
3. Code Review
Use Code Quality Power's code-reviewer
Review Timing:
- Immediately after writing code
- Before submitting PR
- Before merging to main branch
Priority Handling:
- CRITICAL issues: Must fix
- HIGH issues: Should fix
- MEDIUM issues: Consider fixing
- LOW issues: Optional fix
4. Commit and Push
Follow conventional commit format
git add .
git commit -m "feat: add user authentication feature"
git push origin feature/user-auth
Branch Management Strategy
Branch Naming Convention
feature/feature-name - New feature development
fix/issue-description - Bug fix
refactor/refactor-content - Code refactoring
docs/documentation-update - Documentation changes
test/test-content - Test-related
Examples
feature/user-authentication
fix/sidebar-display-issue
refactor/api-response-handler
docs/update-readme
test/add-unit-tests
Branch Lifecycle
-
Create Branch
git checkout -b feature/new-feature
-
Regularly Sync Main Branch
git fetch origin
git rebase origin/main
-
Delete After Merge
git branch -d feature/new-feature
git push origin --delete feature/new-feature
Code Review Checklist
Before submitting PR, self-review:
Functionality
Code Quality
Testing
Documentation
Security
Common Git Commands
View Status and History
git status
git log --oneline --graph --all
git log --follow -- path/to/file
git diff --stat
Undo and Modify
git checkout -- file.txt
git reset HEAD file.txt
git commit --amend
git reset --soft HEAD~1
Branch Operations
git branch -a
git checkout branch-name
git checkout -b new-branch
git branch -d branch-name
git push origin --delete branch-name
Common Issues and Solutions
Issue 1: Wrong Commit Message
git commit --amend -m "correct commit message"
git push --force-with-lease
Issue 2: Forgot to Switch Branch
git stash
git checkout correct-branch
git stash pop
Issue 3: Need to Combine Multiple Commits
git rebase -i HEAD~3
Issue 4: Conflict Resolution
git fetch origin
git rebase origin/main
git add .
git rebase --continue
git rebase --abort
Integration with Development Workflow
Align Phase
- Create feature branch
- Document requirements in ALIGNMENT.md
Architect Phase
- Design documented in DESIGN.md
- Commit design decisions
Atomize Phase
- Break into tasks in TASK.md
- Each task = separate commit
Automate Phase
- Follow TDD for each task
- Commit after each task completion
- Use conventional commit format
Assess Phase
- Create PR with complete summary
- Request code review
- Address review feedback
- Merge after approval
Best Practices Summary
- Frequent Commits - Small steps, each commit does one thing
- Clear Messages - Let others (and future you) quickly understand changes
- Timely Sync - Regularly pull from main branch, avoid large conflicts
- Code Review - Self-review before submitting, request others' review after
- Test First - Follow TDD, ensure code quality
- Sync Documentation - Update documentation when code changes
Related Documentation
- Testing Standards: See testing steering
- Code Review: See code-quality power's code-review.md
- Development Workflow: See development-workflow power
- Coding Standards: See coding steering
Remember: Good Git workflow is the foundation of team collaboration. Clear commits and systematic reviews make everyone's life easier.