# Branch deploy via netlify cli

**URL:** <https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798>\
**Category:** Support\
**Tags:** netlify-cli, deployment\
**Created:** [July 12, 2021, 10:21am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798 "2021-07-12T10:21:19Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 12, 2021, 10:21am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/1 "2021-07-12T10:21:19Z")

</div>

Hi,  
I had auto deployments connected to my bitbucket repo for master, uat and development branches working. However I want to do static code analysis and an npm audit as part of my build. I have configured a CI pipeline that will automatically build my site and do my analysis as required. As part of my pipeline I am using the netlify cli to deploy the statically rendered site. I have turned off Netlify auto deploys as I wish to deploy only from my ci pipeline, in doing so I noticed that visiting the branch deploy url doesn’t render the same site as visiting the deploy preview site. The deploy preview site is correct but the branch deploy url does not update to the latest deployed version. The attached screen shot shows the successful deploy and links in question (I have marked up in red text).  
The netlify cli command I am using as part of my ci pipeline is as follows  
`netlify deploy --dir ./dist/static --auth $NETLIFY_LOGIN --site $NETLIFY_SITE -b uat --message "Deploy UAT branch"`  
As you can see I’m providing the branch name with the -b flag and the branch deploy url is https://uat–…netlify.ap where … is the site name.  
Please note I am using linux env variables in the command for the secrets.  
I have also pulled down the zip file for the deploy in question to confirm that the site was deployed correctly and the zip file contains the desired changes.

Does anyone know why the 2 links from the same deploy serve different content?

 ![netlify-deploy](https://global.discourse-cdn.com/netlify/original/3X/b/7/b74919ef59e48a05da0d7a5dd10fc7cfdeecff4e.png)

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 12, 2021, 10:29am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/2 "2021-07-12T10:29:42Z")

</div>

Hi @ChrisM,

Could we ask which site is this regarding?

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 12, 2021, 11:56am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/3 "2021-07-12T11:56:35Z")

</div>

Hi,  
It’s a client site that I don’t really want to publish the url for at this stage. If I give you the siteId would that help?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 12, 2021, 12:26pm UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/4 "2021-07-12T12:26:59Z")

</div>

Yeah, that would help too.

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 12, 2021, 9:57pm UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/5 "2021-07-12T21:57:46Z")

</div>

The siteId is 8ab3fad1-c239-4a26-abdc-9bb0e08fce33 and the deploy is question is 60ebf8f25500d302216c5232

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 13, 2021, 6:54am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/6 "2021-07-13T06:54:18Z")

</div>

I just checked the links `https://u **--s********* -p *****.netlify.app` and `https://60ebf8f25500d302216c5232--s********* -p *****.netlify.app` and the websites look some to me, at least by the initial appearances. Is there anything specific that should look different?

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 13, 2021, 8:00am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/7 "2021-07-13T08:00:26Z")

</div>

The site was deployed via Netlify auto deploy but I have turned that off as I would like to only use my CI pipeline with the netlify cli deploy.  
If you have a look at the /blog page on both site, we have made a change to the styles that are applied to the blog categories. The change is to fix the alignment, the preview url has the style applied and the uat branch doesn’t.  
I will have to post multiple responses as I am only able to embed a single image in my responses

Screen shot from preview url which is correct  
 ![preview](https://global.discourse-cdn.com/netlify/original/3X/e/6/e6fe30e3d600fb65a1c14a8f96104129df88ec48.png)

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 13, 2021, 8:01am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/8 "2021-07-13T08:01:11Z")

</div>

Screen shot from uat url which does not have the updated style applied  
 ![uat-branch](https://global.discourse-cdn.com/netlify/original/3X/8/9/89b1cc99334d9dcaa68a6c185d8fc729aa263fe8.png)

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 13, 2021, 8:04am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/9 "2021-07-13T08:04:45Z")

</div>

Oh yeah, I can see the problem. I’ll investigate this and let you know.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 13, 2021, 8:55am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/10 "2021-07-13T08:55:02Z")

</div>

Hi @ChrisM,

I believe this is related to [Clarify description of `--alias` flag for `deploy` command · Issue #1984 · netlify/cli · GitHub](https://github.com/netlify/cli/issues/1984#issuecomment-862554734), quoting from there:

> Once you have a branch deploy that was created from our build system, `netlify deploy` with the same alias as that branch doesn’t update the branch URL.

This is probably the issue in your case.

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://answers.netlify.com/u/ChrisM)\
**Post date:** [July 13, 2021, 9:36am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/11 "2021-07-13T09:36:47Z")

</div>

Yes that is exactly the situation I have.  
I couldn’t see a work around listed on the github issue. Are you aware of any work around for this?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 13, 2021, 11:00am UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/12 "2021-07-13T11:00:55Z")

</div>

At the moment, the only thing you can do it use alias as a different name that was not a branch deployed before.

---

<div class="post-metadata">

**Author:** ![mordonez](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/mordonez/32/36673_2.png) [@mordonez](https://answers.netlify.com/u/mordonez)\
**Post date:** [October 16, 2022, 10:17pm UTC](https://answers.netlify.com/t/branch-deploy-via-netlify-cli/40798/13 "2022-10-16T22:17:36Z")

</div>

It is in netlify roadmap this feature?
