Does deploy and branch previews work on subdomains?

Say I am hosting two websites on Netlify.

  1. One website is on the domain www.example.com
  2. The other one is on the sub-domain test.example.com

If I want to enable branch and pull request previews on a subdomain for both the websites. Will it work?

If the first website has a branch called test, then it will be deployed to test.example.com but that subdomain is already used by website 2. What does Netlify do in such case?

Or do I need to move website 2 to some other new domain like www.example1.com to make deploys work?

I got answer from the Netlify support team via email, which I am reproducing here.

Branch Subdomains aren’t enabled by default. You would have to enable each branch subdomain individually.
If you have added a subdomain as a domain alias that is the same a branch name, you will want to remove the domain alias before enabling the branch subdomain.

If there are other questions about this, please let us know here also and we’ll be happy to follow-up with additional information.