In this case, you can have a global user git .gitignore file that will apply automatically to all your repository. This will be useful for IDE and editor files (for instance, swp and *~ files for Vim). Change directory locations to suite your OS
- Add to your ~/.gitconfig file
excludesfile = /home/username/.gitignore
You need to create a ~/.gitignore file with file patterns to be ignored
Save your dot files in another repository so you have a backup (optional).
Any time you copy, init or clone a repository your global gitignore file will be used as well.