I wouldn't use "script" to describe FreeCAD. Regardless, this problem is much more with FreeCAD than with Python.
> I have to add _pycache_ to all the .gitignore
I just add that, once, in my global gitignore.