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.
build:
command: npm run build
output: dist/
deploy:
target: production
branch: main
autoPreview: true
regions: [us-east-1, eu-west-1, ap-southeast-1]
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.
- Unique URLs:
pr-42.project.git.dev - Automatic cleanup after merge
- One-click sharing for reviewers
- Full logging and performance metrics
$ 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.
.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) |
Use environment-specific variable prefixes (e.g., STAGING_, PROD_) to avoid configuration drift during promotions.