Deploy netlify.toml file only?

Hey support team,

I’m using branch deploys AND branch subdomains to setup some subdomains for my site and I basically need the main domain to always redirect to my subdomain, like so:


where the branches are associated as follows


Now, I was able to achieve this behavior using 2 different redirects (between the branches), but I was wondering if it’s possible to delete everything but the netlify.toml from the master branch and have some sort of dummy build command not to build the entire CRA app when pushing anything to master? Granted nobody will push anything to master, but I sort of wanted to cleanup that branch to be honest, since it doesn’t need to have the entire app code.

Hi @niceshadowraze

You’ll need an index.html as well.

Simplest thing is to have an index.html with

<!doctype html><html lang="en"><meta charset=utf-8><title>shortest html5</title>

and a _redirects file with

/*    301!

which will send all traffic to the new domain (you could use a netlify.toml too.)

Hey, thank you for your reply. So can I literally delete everything else in that branch and just leave the index.html and netlify.toml (or _redirects) file in the root dir?

Yes you could (remembering to remove the build command too.)

Alternatively, you could stop deploying the main/master branch altogether, and add as an alias to and have it redirect.

This assumes you are not using the branch deploy feature though, and are deploying branches to separate Netlify sites.

Alright, simple enough. Thank you!