Trunk-based development questions

Hi, @jega. It sounds like you are considering using a unique site for each “trunk”. I was going to recommend this myself.

If you are using different git branches then using our branch subdomain feature makes sense. You are not using different git branches so this won’t work for you.

The next best workaround is just to use different sites as you have suggested.

Also, I want to warn you about a “false workaround”. It is a possible solution some people have already tried and it doesn’t work. So, warning - warning, do not try this:

  • DO NOT use the netlify deploy --alias option to try to use the branch subdomain feature.

This option used to be called the --branch option (and still is although noted as deprecated). It doesn’t make a “true branch deploy” (hence the name change from --branch to --alias). You can get a predictable URL with that but it will not work like a “real” branch deploy. Meaning, branch subdomain features s will not apply to subdomains made using --alias or --branch.

Last but not least, people sometimes want to use branch subdomains and also want to change the subdomain. For example, the branch name may be “development” but they want the subdomain to be just “dev”. If so, the best workaround is the same: use a unique site for each branch and you can use whatever subdomain of you custom domain you want to use. With unique sites, the naming requirements of the branch subdomain feature are removed.

To summarize:

  • The branch subdomain feature is great if you want automatic subdomains based on the branch name.
  • The workaround I would recommend for most (all?) other cases is to use unique sites and handle the naming by hand.

If there are other questions or if you want to share your solution/experience, please reply here anytime.

P.S. I moved these post to a new topic for clarity.