Problem
I would like to have one 'wwwroot' repo for my iis server, with different branches tracking different 'sites', specifically a production site (wwwroot/prod), a dev site (wwwroot/dev) and perhaps some other sites (wwwroot/other).
I assumed it would be trivial to simply have each branch track only it's respective folder, ignoring the other subfolders. This "works", except switching between branches deletes the other branches.
I've tried simple .gitignores that ignore the other directories by name, and more complex .gitignores that ignore everything but the respective directory.
I'm not worried about .gitignore file merge conflicts if/when I decide to merge branches.
I imagine I could use the solution posed elsewhere on SO using different excludes and updating the symlink on branch change, but I don't think that's ideal for long-term/anyone who replaces me. Surely I'm just using .gitignore wrong?
Example
wwwroot/prod (tracked by prod branch, ignores dev and other)
wwwroot/dev (tracked by dev branch, ignores prod and other)
wwwroot/other (tracked by other branch, ignores prod and dev)
but for example, after setting up the gitignores, changing to a different branch causes the other (previously checked out) branch to be removed from wwwroot working directory (and thus the web pages are no longer accessible)