On my MacOS, the global .gitignore file can be created/editted with:
nano ~/.gitignore_global
Here are the current contents which include files I find useful to ignore in my work as a data scientist:
.DS_Store
.ipynb_checkpoints
.Trashes
.RHistory
__pycache__
~$*
~*
*~
.~
*.egg-info
.nbgrader.log
.coverage