12

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

Maxime Ghéraille
  • 1,465
  • 3
  • 16
  • 31

5 Answers5

17

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

haverchuck
  • 430
  • 4
  • 9
  • 8
    Seems no any way to trigger this action by manual function. Only support push the branch to github repos can working. Can't understand this design. – elkan1788 Apr 01 '21 at 13:16
1

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

Source: Deploy An App Without Pushing An Empty Commit

trkaplan
  • 3,217
  • 2
  • 23
  • 26
1

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. enter image description here

Sprint
  • 119
  • 11
0

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"
    }
}
0

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.

Henry
  • 1,077
  • 1
  • 16
  • 41