Use Docker

docker robots

Use Docker! Docker lets you create virtual computers, so that you can have miniature versions of your live site.

You don't need to use Docker on its own, and probably shouldn't -- use of the environments that make it easier. Any one of these three will do the trick -- choose whichever one feels right to you.

DDEV (https://ddev.com) seems to have the biggest following within the Drupal world these days; there's even a few folks pushing to adopt it as a standard.

Lando (https://lando.dev) is the one that I use (I'm friends with the founders) and the best choice if you like Star Wars references.

Docksal (https://docs.docksal.io) is also a terrific choice (I used it on a big government project I worked on last year.)

You'll need a fairly powerful machine (16GB or more of RAM and lots of disk space) and you should be comfortable with command-line Unix, but you'll soon understand why Docker is such a popular choice these days. Since it's so easy to create multiple copies of whatever you're working on, you can afford to take chances and try things, which makes it a lot easier to work your way to a solution.