# Git Workflow Guide **Effective Date:** 2026-04-28 (production branch added) **Policy:** Feature branches merge to `master` (staging). `production` branch is the live deploy target. --- ## Overview ### Three Branches | Branch | Purpose | |--------|---------| | `feature/*`, `week-*` | Development branches. Merge to master when done. | | `master` | Staging/dev. No deploy hook. Safe for testing and WIP. | | `production` | Live. Triggers deploy. Only merge from master when ready. | ### Workflow ``` Feature branch (develop, test) ↓ Merge to master (staging, review) ↓ Merge to production (LIVE DEPLOY) ``` ### Branch Naming - Feature branches: `feature/*`, `week-*`, `content/*`, `fix/*` - Examples: `feature/dark-mode`, `week-5-forms`, `content/article-update`, `fix/button-style` --- ## Feature Branch Workflow ### Step 1: Create Feature Branch (Optional) For significant work, create a feature branch: ```bash # Ensure you're on master and up to date git checkout master git pull origin master # Create feature branch git checkout -b feature/my-feature # or: git checkout -b week-5-forms # Verify branch created git branch -v ``` ### Step 2: Implement Changes While on the feature branch, implement all changes: ```bash # Make changes to CSS, templates, content, docs vim themes/danix-xyz-hacker/assets/css/main.css vim content/en/articles/new-article/index.md # Rebuild CSS after changes npm run build # Test in browser hugo server # Check what changed git status git diff ``` ### Step 3: Commit Regularly Commit after completing each component or logical chunk: ```bash # Stage specific files git add themes/danix-xyz-hacker/assets/css/main.css git add themes/danix-xyz-hacker/layouts/partials/card.html # Commit with clear message git commit -m "feat: add article card component with hover effects" # Or use commit message with body for detailed explanation git commit -m "feat: add article card component - Image with 16:9 aspect ratio - Title, excerpt, badge, button - Hover: lift -2px, shadow enhancement - Dark/light mode support - Mobile-first responsive design" ``` ### Step 4: Review Changes Before Merge Before merging to master, review all changes: ```bash # Show all commits in this branch git log master..feature/my-feature --oneline # Show all file changes (diff summary) git diff --stat master..feature/my-feature # Show detailed diff for critical files git diff master..feature/my-feature # Check git log looks good git log --oneline -10 ``` ### Step 5: Test Thoroughly Before Merge Test everything on the feature branch: ```bash # Start dev server hugo server # Test in browser: # - Dark mode # - Light mode # - Mobile (320px), tablet (768px), desktop (1060px+) # - Keyboard navigation (Tab, Shift+Tab, Escape) # - All interactive elements # - Responsive layouts # Run CSS build without errors npm run build # Check for console errors # (Open browser DevTools → Console) ``` ### Step 7: Create Summary & Complete Documentation At end of week, finalize documentation: ```bash # Create week completion summary cat > WEEK3-IMPLEMENTATION.md << 'EOF' # Week 3 Implementation — Card Layouts & Navigation [detailed implementation report] EOF # Update memory with completion record cat > memory/week3_complete.md << 'EOF' --- name: Week 3 Complete: Cards & Navigation description: Article card component, navigation header, hamburger menu, breadcrumbs type: project --- [completion details] EOF # Commit documentation git add WEEK3-IMPLEMENTATION.md memory/week3_complete.md git commit -m "docs: week 3 implementation complete" ``` ### Step 6: Merge to Master Once testing is complete: ```bash # Switch to master git checkout master git pull origin master # Merge feature branch git merge feature/my-feature # Optional: Delete the feature branch git branch -d feature/my-feature # Verify merge git log --oneline -10 # Push to staging (no deploy yet) git push origin master ``` ### Step 7: Deploy to Production When master is ready for the live site: ```bash # Switch to production git checkout production git pull origin production # Merge master into production git merge master # This triggers the post-receive hook and live deploy git push origin production # Verify deployment # - Check server logs # - Test the live site ``` --- ## Commit Message Guidelines ### Format ``` :