# Git Workflow

## Branch Strategy

```
main          ← production-ready
develop       ← integration branch (optional)
feature/*     ← new features
fix/*         ← bug fixes
hotfix/*      ← urgent production fixes
```

## Branch Naming

```
feature/booking-payment-flow
feature/admin-tenant-management
fix/double-booking-race-condition
hotfix/midtrans-webhook-signature
docs/api-scribe-setup
```

## Commit Messages

Use [Conventional Commits](https://www.conventionalcommits.org/):

```
feat: add owner daily report export
fix: prevent double booking on concurrent requests
docs: add customer user manual
test: add PriceCalculator unit tests
refactor: extract VenueCacheService
chore: update dependencies
```

Format: `{type}: {description}` (lowercase, imperative mood)

## Development Flow

1. **Create branch** from `main` or `develop`
   ```bash
   git checkout -b feature/my-feature
   ```

2. **Develop** with small, focused commits

3. **Test** before pushing
   ```bash
   php artisan test
   cd booking-frontend && npm run test && npm run build
   ```

4. **Push** and open Pull Request
   ```bash
   git push -u origin feature/my-feature
   ```

5. **Code Review** — address feedback

6. **Merge** via squash merge (preferred) or merge commit

## Pull Request Checklist

- [ ] Tests pass (CI green)
- [ ] No secrets in diff
- [ ] Migrations included (if schema change)
- [ ] API docs updated (`php artisan scribe:generate` if endpoints changed)
- [ ] Frontend build succeeds

## Release Tags

```bash
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0
```

Semantic versioning: `MAJOR.MINOR.PATCH`

## Do NOT

- Force push to `main`
- Commit `.env`, credentials, or `vendor/`
- Skip tests for "quick fixes"
- Mix unrelated changes in one PR
