---
title: "CLI: Deploy and Delete Environments by Branch Name"
description: ""
canonicalUrl: "https://zuplo.com/changelog/2026/09/29/cli-deploy-delete-branch"
pageType: "changelog"
date: "2026-09-29"
tags: "cli"
---
`zuplo deploy` and `zuplo delete` now both take a `--branch` flag, so a CI job
can create a preview environment under a branch name and clean it up later with
the same name. Existing commands, flags, and output work exactly as before.

- **Deploy as a branch**: `zuplo deploy --branch my-feature` deploys the
  environment as `my-feature` instead of the current Git branch. If you also
  pass `--environment`, the `--branch` value wins.
- **Delete by branch**: `zuplo delete --branch my-feature` deletes the
  environment deployed from that branch. Pass either `--url` or `--branch`, not
  both.

```bash
npx zuplo deploy --branch pr-142
# later, when the pull request closes
npx zuplo delete --branch pr-142 --wait
```

`--environment` on `zuplo deploy` keeps working and is now marked deprecated in
the help text in favor of `--branch`. An exported `ZUPLO_BRANCH` environment
variable doesn't choose the environment for either command: `zuplo deploy`
ignores it, and `zuplo delete` deletes by branch only when you type the
`--branch` flag.

See the [`zuplo deploy`](https://zuplo.com/docs/cli/deploy) and
[`zuplo delete`](https://zuplo.com/docs/cli/delete) references for every option.