I wonder why there aren't super popular solutions for managing hosts entries in an automated way for development, since if you need to share entries with other people for a bunch of projects, then adding them manually is cumbersome and running a separate DNS server just for development is not less so, whereas using public DNS records set to local addresses seems a bit dirty.
https://github.com/2ndalpha/gasmask did this for Macs but I've found that I just don't need it. A static file is fine. I often have old entries in it that I don't use anymore but they don't harm anything being there so they stick around until I do a cleanup pass.