DEV Community

Cover image for Deploying a Branch to Netlify on the Command-Line
Jamie Tanna
Jamie Tanna

Posted on

Deploying a Branch to Netlify on the Command-Line

This post originally appeared on my personal website.

I'm very excited to say that the Netlify CLI tool ( netlify/cli) now has the ability to deploy a branch on the command-line.

This has been a feature request since at least 2018 and has been greatly anticipated from the community, and I've been wanting to use it for some time when using GitLab CI pipelines.

As of netlify-cli@2.53.0, it's now possible to deploy using the -b $branchName flag:

% netlify deploy -b wibble
Deploy path:        /home/jamie/workspaces/talks/public
Configuration path: /home/jamie/workspaces/talks/netlify.toml
Deploying to draft URL...
✔ Finished hashing 286 files
✔ CDN requesting 0 files
✔ Finished uploading 0 assets
✔ Deploy is live!

Logs:              https://app.netlify.com/sites/epic-wozniak-9aa019/deploys/5ed7eaedb88cedbb42a9d341
Website Draft URL: https://wibble--epic-wozniak-9aa019.netlify.app

If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag.
netlify deploy --prod
Enter fullscreen mode Exit fullscreen mode

This is super exciting, and will help help folks deploying from Continuous Integration platforms, or with use cases where they don't want to use Netlify's Webhook integrations.

Top comments (0)