2026-10-18
Put a feature branch on an existing Coolify URL, then put it back
The URL stayed the same. I changed which Git branch Coolify built for that one app.
I needed to show a feature branch on an app's existing demo URL without merging a much larger body of work into the default branch. Coolify was already deploying that app from Git. Changing the application's configured branch let the same URL serve the branch I wanted to show.
Change the app branch, then deploy it
Push the feature branch through your normal repository checks. Record the app's current git_branch first so you have an exact value to restore. On the server that already holds your Coolify API token, PATCH that existing application with the new git_branch. The token stays on that server; the example below assumes it is already available as an environment variable and shows no credential location or value.
curl -X PATCH \
"$COOLIFY_URL/api/v1/applications/$APP_UUID" \
-H "Authorization: Bearer $COOLIFY_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"git_branch":"feature/demo"}'Trigger a deploy for that app and read the deployment log through to finished. Then check the page at the existing URL. In my setup a push to the newly selected branch could also trigger the GitHub App webhook, so I treated subsequent pushes to that branch as live deploys until I switched the app back.
The return path is another branch switch
PATCH git_branch back to the value you recorded, then deploy again and verify the old branch is live. For my app that value was master. For yours it may be main or another name. Do not just merge the branch to get back to the previous site: that changes the repository as well as the app configuration.
The current Coolify API documentation lists git_branch in PATCH /applications/{uuid}. Verify that field and your app's selected branch against your installed version before changing a live app.
Topics
More notes
- A fresh DNS record existed, but my Mac still said the domain did not
- Check the offsite copy of a Coolify compose database backup
- Two Umami first-boot checks I nearly missed on Coolify
- Choosing a VPS in Australia for self-hosting
- Point your app at a Coolify Postgres by container name, not IP
- A launchd job that dies with no code change
- Coolify quietly bakes your build secrets into the image layers
- A full VPS disk on Coolify: 1905 MB per rebuild, down to 31 MB
- The Next.js standalone healthcheck trap on Coolify
- serve -s makes every URL on a multi-page site come back 200