Deploying a Branch to Netlify on the Command-Line

Featured image for sharing metadata for article

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

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.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #netlify #netlify-cli.

Also on: Lobste.rs logo dev.to

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.