The Deployer documentation
Creating & deploying a project

Deploy from another branch

A project builds one branch of its repository. You can move it to another branch at any time, for example from a personal branch to main or prod, so the project no longer depends on a branch someone might delete.

Where to find it

Open your project. The header shows the repository and, next to it, the branch the project builds. Click the branch name to open Deploy from another branch. You need permission to change the project's settings, and on a live project also permission to deploy it.

Choosing a branch

The panel lists the repository's branches. The one the project builds is marked building now, and the one the running version came from is marked live. Pick another branch and the panel shows what changes before anything does:

  • Code: the branch's latest commit, and how many files differ from the version that is live.
  • The Dockerfile: whether the Dockerfile the build uses is on that branch. That is Dockerfile, or the file chosen under Build method. The panel also checks whether it still mounts the build secrets you have set. If the branch has no Dockerfile, The Deployer writes one, and that one mounts no build secrets.
  • Environment files read from Git keep reading from the old branch. The panel names them, and you can move them under Environment variables.
  • Fixes The Deployer committed to the old branch, such as a health check route, are named if the new branch doesn't have them, so you can merge them first.

If the build would stop, for example because a Dockerfile chosen under Build method isn't on the branch, the panel says so and won't switch until it is fixed.

What happens when you switch

On a live project the button reads Switch to prod and deploy:

  • It is a Pull & Restart from the new branch. The project keeps its settings, secrets, servers and domains. The deployment is labelled Branch in the history, and each deployment row shows the branch and commit it built.
  • Your app stays up. The current version keeps serving until the new one passes its health check. If the new one fails, the old version keeps running. Fix the branch and push, or switch back here.
  • Pushes follow the new branch. With push-to-deploy on, pushes to the new branch deploy and pushes to the old one don't. Deleting the old branch afterwards doesn't affect the project.
  • A waiting automatic retry of the old branch is called off, so it can't deploy the old branch over your choice.

A project that has never been deployed just changes branch: its next deployment builds the new one.

You can't switch while a deployment is running. Wait for it to finish, then switch.

Related