Debuggers can be attached to VMs, most USB devices can be redirected to the VM, at least Oracle VBox and VMWare (the ones I'm using).
I'm also pushing datasheets to my git repositories, as well as all measurements, notes, prototype photos, everything.
As an extra step, for all my Arduino and Javascript project,s I'm pushing the small 3rd party libraries as well. Sometimes they have bugs or unperformant code that needs to be modified, other times you cannot just rely on free hosting to be available 3 years from now.
For Java (offtopic, but a bit related) you have the choice of using Maven repositories - which is nice when it works - and the libraries are usually more mature. However, after some years I find that some library updates break existing projects or the needed dependencies cannot be found. This is why I'm advocating that, for a project which you don't want to constantly maintain, you keep a local copy of all the dependencies.
Back to the topic of VMs: I use them a lot for my personal projects but I find that in large companies they are seldom used. Probably because they don't want to deal with the hassle of securing, storing and transferring gigabytes on the slow corporate network. For example my last big client had the USB ports blocked on all computers but they were accessible through the VM.
One VM per project is a bit overkill, a better approach is to build a new VM every few years or so when the tools and OSs change significantly. An example: I cannot maintain an old Windows Phone 7 project because the MS tools require me to build for the latest WP iteration and the new tools only run on windows 10. While this is pretty specific it can be indicative of the things to come.
Also, what about using devices with unsigned drivers? For old unmaintained devices the logical thing is to dedicate an XP machine for those.
Another issue is site availability. Google code went down a few years ago, not sure if anyone predicted that. Github looks strong now but can you really rely on it to be there 5 years from now? Are you relying on the archive section of Microchip or archive.org to resolve dependencies? I think it's obvious that we need several backups in different physical locations.
Offline storage is pretty cheap, 100$ for 4TB, it can probably hold at least 100 projects with all the VMs and repositories.
That was a long rant, I'm going to stop now.
TL;DR: create VMs for each generation of projects, commit datasheets and project notes into version control, commit used library versions to avoid breaking updates or future lack of availability, keep offline backups of everything.