Next.js Discord

Discord Forum

Prevent vercel projects from auto-deploying if other branches have new commits

Answered
Belgian Hare posted this in #help-forum
Open in Discord
Belgian HareOP
I have many vercel projects, lshr-prod -> main branch, lshr-dev -> dev branch

Now if i push changes on main branch, why does lshr-dev deploy too?

How do i prevent this behavior, i added
Answered by joulev
no, only have one project. why do you have multiple projects?
View full answer

27 Replies

Answer
@joulev no, only have one project. why do you have multiple projects?
Belgian HareOP
cuz the repo has multiple branches
prod test dev etc
@Belgian Hare cuz the repo has multiple branches
yes and they all belong to the same project on vercel. you can deploy many branches in the same project and assign different domains for each of them
@Belgian Hare different env vars for each branch too?
Belgian HareOP
ic, i'll try
i dont have docs links for you but i tried to do this before and it was pretty straightforward from the UI (example, the screenshot above)
Belgian HareOP
oh this one?
cool :0
* production is the main branch
* all other branches are preview
* environment variables and domains can be assigned per-branch
@Belgian Hare Click to see attachment
yeah exactly
@joulev yeah exactly
Belgian HareOP
but the non production branches werent deploying
only the prod branch used in the project was deploying
whenever i pushed a commit to other branches, i expected it to deploy too 🤔
They should be deploying, just not to Production environment. They should be deployed to Preview
Belgian HareOP
ohh, let me try again
@joulev They should be deploying, just not to Production environment. They should be deployed to Preview
Belgian HareOP
this should be ok right?
just shows the preview label
deploying now, i dont see lshr-sitt there!
@Belgian Hare deploying now, i dont see lshr-sitt there!
The domain is only added after the deployment is complete
@joulev The domain is only added after the deployment is complete
Belgian HareOP
thx it works! but it asks for vercel authentication 😨

can i disable that?
nvm just learned about deployment protection and turned it off