Git workflow and source control management for ecommerce team. Covers Conventional Commits, branch strategy, PR workflow, and conflict resolution. Triggers on "git", "commit", "branch", "merge", "rebase", "pull request", "PR", "conventional commits", "git workflow", "push", "commit message". PROACTIVE: MUST invoke when performing Git operations.
Resources
1Install
npx skillscat add lorenzogirardi/ai-ecom-demo/scm Install via the SkillsCat registry.
SKILL.md
ABOUTME: Git workflow skill for ecommerce project
ABOUTME: Covers Conventional Commits, GitHub Flow, and team collaboration
Source Control Management (SCM) Skill
Quick Reference
| Principle | Rule |
|---|---|
| Atomic Commits | One logical change per commit |
| Conventional Commits | type(scope): description format |
| Branch Naming | type/ticket-description format |
| PR Size | < 400 lines of code changes |
| Never Force Push | To shared branches (main) |
Branching Strategy (GitHub Flow)
main ─────●───────●───────●───────●──────
│ ↑ │ ↑
↓ │ ↓ │
feature ──●──●──●─┘ fix ──●──●────┘Branches:
main: Always deployable (protected)feature/*: New featuresfix/*: Bug fixeschore/*: Maintenancedocs/*: Documentation
Conventional Commits
Format
<type>(<scope>): <description>
[optional body]
[optional footer]Types
| Type | Description | Example |
|---|---|---|
feat |
New feature | feat(cart): add quantity selector |
fix |
Bug fix | fix(auth): correct token refresh logic |
docs |
Documentation | docs(api): update endpoint docs |
style |
Formatting | style(frontend): fix indentation |
refactor |
Code restructure | refactor(orders): extract validation |
test |
Tests | test(catalog): add search tests |
chore |
Build/tooling | chore(deps): update dependencies |
perf |
Performance | perf(redis): optimize cache keys |
ci |
CI config | ci(actions): add security scan |
Scopes (Ecommerce)
| Scope | Area |
|---|---|
auth |
Authentication module |
catalog |
Products, categories |
cart |
Shopping cart |
orders |
Order processing |
checkout |
Checkout flow |
frontend |
Next.js app |
backend |
Fastify API |
infra |
Terraform/K8s |
ci |
GitHub Actions |
Branch Naming
<type>/<ticket>-<description>
Examples:
- feature/ECOM-123-user-wishlist
- fix/ECOM-456-cart-total-calculation
- chore/ECOM-789-update-node-versionCommit Workflow
TDD Commit Pattern
# Red phase
git add tests/
git commit -m "test(auth): add login validation tests"
# Green phase
git add src/
git commit -m "feat(auth): implement login validation"
# Refactor phase
git add src/
git commit -m "refactor(auth): extract validation helpers"Multi-line Commit (HEREDOC)
git commit -m "$(cat <<'EOF'
feat(cart): add persistent cart storage
- Store cart in Redis with user session
- Expire after 7 days of inactivity
- Merge guest cart on login
Closes #123
EOF
)"Pull Request Workflow
Before Creating PR
# 1. Ensure branch is up to date
git fetch origin
git rebase origin/main
# 2. Run tests locally
npm run test
# 3. Check linting
npm run lint
# 4. Review changes
git diff origin/main...HEAD
git log origin/main..HEAD --onelinePR Description Template
## Summary
- Brief description (1-3 bullet points)
## Changes
- Added X feature
- Modified Y component
- Fixed Z bug
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Screenshots (if UI changes)
[Before/After]
## Related Issues
Closes #123PR Size Guidelines
| Size | Lines | Review Time |
|---|---|---|
| XS | < 50 | Minutes |
| S | 50-200 | < 30 min |
| M | 200-400 | < 1 hour |
| L | 400-800 | Hours |
| XL | > 800 | Split required |
Conflict Resolution
Understanding Conflicts
<<<<<<< HEAD (current branch)
const timeout = 5000;
=======
const timeout = 10000;
>>>>>>> feature-branch (incoming)Resolution Commands
# Keep current branch version
git checkout --ours path/to/file
# Keep incoming version
git checkout --theirs path/to/file
# After manual resolution
git add path/to/file
git rebase --continueSafety Rules
Never Do
# Never force push to main
git push --force origin main # DANGEROUS
# Never rebase shared branches
git rebase main # on shared feature branch
# Never reset pushed commits
git reset --hard HEAD~3 # if already pushedSafe Alternatives
# Use force-with-lease
git push --force-with-lease
# Merge instead of rebase on shared
git merge origin/main
# Revert instead of reset
git revert <sha>Common Operations
Undo Operations
# Undo last commit (keep changes)
git reset --soft HEAD~1
# Undo uncommitted changes
git checkout -- path/to/file
# Revert pushed commit
git revert <sha>Stashing
# Stash changes
git stash save "WIP: feature description"
# List stashes
git stash list
# Apply and drop
git stash popChecklist
Before committing:
- Changes are atomic (one logical change)
- Commit message follows Conventional Commits
- Tests pass locally
- No debug code or console.logs
- No secrets or credentials
- Branch is up to date with main
Before creating PR:
- Rebased on latest main
- All commits have meaningful messages
- PR is < 400 lines
- Description explains what and why
- Related issues linked
- CI checks pass