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”. PROACTI
npx playbooks add skill lorenzogirardi/ai-ecom-demo --skill scm
| 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) |
---
main ─────●───────●───────●───────●──────
│ ↑ │ ↑
↓ │ ↓ │
feature ──●──●──●─┘ fix ──●──●────┘
Branches:
main: Always deployable (protected)feature/*: New featuresfix/*: Bug fixeschore/*: Maintenancedocs/*: Documentation---
<type>(<scope>): <description>
[optional body]
[optional footer]
| 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 |
| 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 |
---
<type>/<ticket>-<description>
Examples:
- feature/ECOM-123-user-wishlist
- fix/ECOM-456-cart-total-calculation
- chore/ECOM-789-update-node-version
---
# 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"
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
)"
---
# 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 --oneline
## 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 #123
| 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 |
---
<<<<<<< HEAD (current branch)
const timeout = 5000;
=======
const timeout = 10000;
>>>>>>> feature-branch (incoming)
# 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 --continue
---
# 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 pushed
# 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>
---
# Undo last commit (keep changes)
git reset --soft HEAD~1
# Undo uncommitted changes
git checkout -- path/to/file
# Revert pushed commit
git revert <sha>
# Stash changes
git stash save "WIP: feature description"
# List stashes
git stash list
# Apply and drop
git stash pop
---
Before committing:
Before creating PR:
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.