Local dev
netlify dev
Run the site with functions locally
netlify dev --port <port>
Use another port
netlify dev --command "<cmd>"
Set the framework dev command
netlify dev --live
Share a public tunnel URL
netlify dev --no-open
Do not open the browser
netlify dev --offline
Skip features needing the network
netlify dev --context <context>
Use another env var context
netlify dev --filter <app>
Pick an app in a monorepo
netlify serve
Production build, served locally
netlify build
Run the build locally
netlify build --dry
Show build steps without running
netlify build --context deploy-preview
Build with preview env vars
Deploy
netlify deploy
Deploy a draft
netlify deploy --prod
Deploy to production
netlify deploy --dir <path>
Folder to publish
netlify deploy --functions <folder>
Functions folder to ship
netlify deploy --no-build
Skip the build step
netlify deploy --message "<msg>"
Note in the deploy log
netlify deploy --alias <name>
Predictable draft subdomain
netlify deploy --json
Print deploy data as JSON
netlify deploy --open
Open the site afterwards
netlify deploy --prod-if-unlocked
Prod if unlocked, else draft
netlify deploy --site <name-or-id>
Target a specific project
netlify deploy --env <KEY>=<value>
Deploy-only var for functions
netlify deploy --secret-env <KEY>=<value>
Same, masked in UI and API
netlify deploy --allow-anonymous
Deploy without an account
netlify claim
Claim an anonymous deploy
netlify watch
Wait for a deploy to finish
Env vars
netlify env:list
List variables
netlify env:get <name>
Print one value
netlify env:set <name> <value>
Set a variable
netlify env:unset <name>
Remove a variable
netlify env:import <file>
Load variables from a .env file
netlify env:import <file> --replace-existing
Replace instead of merge
netlify env:set <name> <value> --context
production
Limit to a deploy context
netlify env:set <name> <value> --scope
builds
Limit to builds or functions
netlify env:set <name> <value> --secret
Make the value unreadable later
netlify env:list --context <context>
List one context (default dev)
netlify env:list --plain
Print as plain text
netlify env:clone --to <project-id>
Copy variables to another project
Deploy contexts
| Context |
Used for |
production |
Production deploys |
deploy-preview |
Pull request previews |
branch-deploy |
Branch deploys |
dev |
netlify dev and CLI default |
branch:<name> |
One specific branch |
Logs & projects
netlify logs
Recent function logs (10 min)
netlify logs --follow
Stream logs live
netlify logs --since <time>
Widen the time window
netlify logs --function <name>
Only one function
netlify logs --source deploy --deploy-id <id>
Build logs of a deploy
netlify logs --level error
Only given levels
netlify logs --json
JSON Lines output
netlify sites:list
List your projects
netlify sites:search <name>
Find projects by name
netlify sites:delete <id>
Delete a project for good
netlify status:hooks
Show hooks of the linked project