Deployment Strategies

Learn how to configure, automate, and manage deployments across your environments with .git.

Automatic Deployments

.git automatically builds and deploys your code on every push to your configured branches. By default, pushes to main trigger a production deployment, while other branches create preview environments.

.git/config.yml
build:
  command: npm run build
  output: dist/
  
deploy:
  target: production
  branch: main
  autoPreview: true
  regions: [us-east-1, eu-west-1, ap-southeast-1]
â„šī¸
Zero-Config Deployments

If no .git/config.yml is present, .git automatically detects your framework (Next.js, React, Vue, Svelte, etc.) and applies optimized defaults.

Preview Environments

Every pull request or feature branch automatically generates an isolated preview deployment. These previews share your production database schema but use isolated storage and environment variables.

bash
$ git push origin feature/auth-flow
Enumerating objects: 42, done.
✓ Build succeeded (4.2s)
✓ Preview deployed → https://feat-auth.project.git.dev

Rollbacks & Safety Nets

Every deployment is immutable and versioned. If something goes wrong, you can instantly rollback to any previous build with a single command or click.

âš ī¸
Database Migrations

.git does not automatically rollback database changes. Use forward-compatible migrations and configure safe rollback hooks in your pipeline.

Environment Variables

Manage secrets and configuration across environments securely. Variables are encrypted at rest and injected at build/serve time.

Variable Type Description
NODE_ENV System Runtime environment identifier
EDGE_REGIONS Config Comma-separated deployment targets
DB_PASSWORD Secret Production database credentials
PREVIEW_TTL Config Auto-cleanup timeout (hours)
✅
Best Practice

Use environment-specific variable prefixes (e.g., STAGING_, PROD_) to avoid configuration drift during promotions.