Using nix I made everything reproducible. So given a project name and branch name, everything is checked out (shallow checkout for big projects) and setup for me. If I'm working on another machine, just run "launch org/project <branch>" and profit.
There are edge cases: if I forget to push, I do remote in and do that. When I'm done with a branch, I make it a habit to purge that "instance" of the project. But first I have git go through the project and its submodules (if any) and ensure everything has been pushed and the repo not modified.
Note: my projects are database backed and have state etc. All of that is part of the setup script, per project. If your database is in a customized-state for development for a super specific scenario, then you're probably not automatically testing it and that's a code smell to me.
[1] https://medium.com/@Joachim8675309/devops-concepts-pets-vs-c...