Is there a way to select a custom branch to deploy ? I do not seem to be able to select a branch and it takes the default main branch
thanks in advance
Is there a way to select a custom branch to deploy ? I do not seem to be able to select a branch and it takes the default main branch
thanks in advance
Vercel automatically deploys any commit you push to a branch.
You can also customize which branch is used as the Production Branch in the project settings: Go to Project Settings > Git > Production Branch
If you want to deploy a branch without pushing a commit, you can use vercel-cli
.
To re-deploy the preview environment:
vercel --force
To re-deploy the production environment:
vercel --prod --force
If you haven't setup vercel-cli
yet check Vercel's CLI document
I am able to view the latest commit made on my repo by heading to Deployments
tab then click the three dots of a specific commit that you want to deploy. Choose the Redeploy
option from the drop down list.
This works for me: add the code to vercel.json file in root directory:
{
"env": {
"BRANCH": "custom-branch"
},
"scripts": {
"vercel-deploy": "if [ \"$BRANCH\" != \"main\" ]; then echo \"Cannot deploy from $BRANCH branch\"; exit 1; fi"
}
}
Seems no way to choose a branch when creating a new project. But, after deployment first, you can change Production Branch in Settings/Git configuration.