Description

Ensure the project's production branch is set to a stable, protected branch such as main, and that production deployments come only from that branch. The branch should have protection rules in the Git provider, such as required reviews, so changes cannot reach production without approval.

Rationale

If production is linked to a feature branch or an unprotected branch, untested or unreviewed code can go live immediately. Production deployments made directly from local machines also skip review. Using a stable, protected branch makes sure every production change has been reviewed and tested before users see it.

Impact

  • Only reviewed code reaches production

  • Reduces the risk of broken or malicious releases

  • Direct CLI production deploys should be limited

Default Value

By default, the production branch is the repository's default branch, often main. It can be changed in the project's Environments settings.

Pre-Requisites

  • Team Owner or Member role, or Project Administrator

  • Admin access to the Git repository to set branch protection

Test Plan

  1. Sign in to Vercel at https://vercel.com.

  2. Select your team from the team switcher.

  3. Select the project from the dashboard.

  4. Open Settings in the sidebar, select Environments, and open Production.

  5. In the Branch Tracking section, verify that it shows Branch is followed by a stable branch such as main. The Environments list also shows this branch next to Production.

  6. Open Deployments, filter by Production, and verify that recent production deployments came from that branch.

  7. In your Git provider, verify that the branch has protection rules such as required reviews.

  8. If any of these fail, follow the implementation steps.

Implementation Steps

  1. Sign in to Vercel at https://vercel.com.

  2. Select your team from the team switcher.

  3. Select the project from the dashboard.

  4. Open Settings in the sidebar, select Environments, and open Production.

  5. In the Branch Tracking section, keep Branch is selected, enter your stable branch (for example, main), and select Save.

  6. In your Git provider, add branch protection rules that require pull request reviews for that branch.

Backout Plan

  1. Sign in to Vercel at https://vercel.com.

  2. Select your team from the team switcher.

  3. Select the project from the dashboard.

  4. Open Settings > Environments > Production and set Branch Tracking back to the previous branch.

Reference