How to maintain variables that point to data such as user data scripts

So I have encountered an article that explains a way to maintain modules in git:

the article describes a way to reference a module from git and to a specific git commit so that changes will not apply to different environments such as production until desired.

I wanted to know if this is applicable to variables pointing to files such as user data scripts, and if not what is best practice for that.

thanks : )