# Git Workflow Quick Reference

## Three Branches

| Branch | Purpose | Deploy |
|--------|---------|--------|
| `feature/*`, `week-*` | Development | No |
| `master` | Staging/dev | No |
| `production` | Live | **Yes** |

## Create Feature Branch (Optional)

```bash
git checkout -b feature/my-feature
# or: git checkout -b week-5-forms
git branch -v
```

## During Development

```bash
# Check status
git status

# See what changed
git diff

# Stage and commit
git add <files>
git commit -m "feat: add component"

# Rebuild CSS if changed templates
npm run build

# Test
hugo server
```

## Review Changes

```bash
# View recent commits
git log --oneline -10

# View all changes since master
git diff master..feature/my-feature

# View changes summary
git diff --stat master..feature/my-feature
```

## Merge to Master (Staging)

```bash
git checkout master
git pull origin master
git merge feature/my-feature
git branch -d feature/my-feature  # optional
git push origin master
```

## Deploy to Production (LIVE)

```bash
git checkout production
git pull origin production
git merge master
git push origin production
# ← This triggers the live rebuild
```

## Common Commands

```bash
# Undo last commit (keep changes)
git reset --soft HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1

# Switch branches
git checkout master
git checkout feature/my-feature

# Rebase feature branch on latest master (optional)
git checkout feature/my-feature
git rebase master
```

## Commit Message Template

```
feat: add contact form component

- Form validation
- Dark/light mode support
- WCAG AA accessibility
```

## Key Points

✅ Feature branch or quick master commits  
✅ Commit regularly after logical units  
✅ Clear commit messages  
✅ Test in browser before merging  
✅ Merge feature → master (staging)  
✅ Merge master → production (LIVE DEPLOY)  

## For Full Details

See `GIT-WORKFLOW.md` for comprehensive documentation.
