Ok, then I'm glad I didn't spend to much time writing an off-topic answer ;-)
A very common practice is to store dot files (.profile and the likes) into Git in order to make it easy to restore them (later if some bad changes happen or after a fresh install). ANd a good side effect is that it forces you to make sure you don't put credentials/api-tokens or other secrets anywhere in your profile/alias/env files. If you don't use autoenv/direnv of tools like that, it's quite common and convenient to store a few api tokens in som environment variables. If you do so, make sure you group them in a specific file which is never stored in git (and the same goes for ssh keys, ....)
Another popular topic is to use ansible on your localhost to automate that. I won't go into details here, but you will easily find many blog post describing that if you search for 'ansible laptop setup'.
To be honest, I haven't gone that far yet, I install my OS only from time to time, and leverage this as an opportunity to clean everything so I want to conscientiously verify what I install, which version, if it still makes sense, ... all of this is quite manual).
But if I were to reinstall my OS frequently, this would be a solution I would definitely use, since it'S very easy to get started and can bring you a long way.