Here's a neat trick.
I treat my git clones as disposable between computers, but keep my project-specific dotfiles (usually containing environment variables, individual configurations, and so on) synced across devices in iCloud. Then, this script is just a matter of adding symlinks for each of the dotfiles I've saved for each of my projects to each of their clones.
So if my dotfiles are saved like this:
$ tree -a ~/icloud-drive/dotfiles/project-dotfiles/
/Users/justin/icloud-drive/dotfiles/project-dotfiles/
├── searls
│ ├── fine_ants_app
│ └── searls.github.com
│ └── .rgignore
└── testdouble
├── scheduled-merge
│ └── .env
└── testdouble.js
├── .projections.json
├── .rgignore
└── .vimrc
And my repos are organized symmetrically:
$ tree -a ~/code
/Users/justin/code/
├── searls
│ ├── fine_ants_app
│ └── searls.github.com
└── testdouble
├── scheduled-merge
└── testdouble.js
Then I can run project-dotfiles-link
, at any point and it'll make sure each of those working copies have links to my synchronized dotfiles.