Isolating deployments across branches in a single Git repo

Hello,

I’m facing a peculiar situation deploying on Vercel and can’t seem to figure out if I have any options left.

We are deploying multiple websites from a single Git repository in different branches. The problem is that committing to any of these branches will trigger a deployment for apps built from other branches.

So far I’ve tried git.deploymentEnabled and ignoreCommand in vercel.json and both seem to be ineffective for my purpose.

  • When using minimatch patterns in git.deploymentEnabled I can prevent a certain branch from triggering deployments, but I can’t stop apps deployed from other branches to use this as a new trigger!

  • When using ignoreCommand in vercel.json , I have access to the env var VERCEL_GIT_COMMIT_REF using which I can check which branch this commit is coming from, not where it should trigger deployment.

It took me a while to understand how these options work and finally realizing I’ve been barking at the wrong tree the whole time.

I would appreciate any help regarding this!

Branches are generally used for multiple codebases for the same project. If you want a single repo for multiple projects, then a Monorepo structure like https://turborepo.com/ is fully supported on Vercel

Using branches in a single repo for separate projects is non-standard and won’t work out of the box with most services. For this workflow you will probably need to use a custom Github Action instead of our built in git integration. We have a setup guide here that you should be able to modify to change deploy targets based on the branch

1 Like