Ignoring files in GIT

One of the things we all do when we use git is to create a .gitignore file in the root of the GIT repository. But what if you find yourself ignoring the same files time after time?

Luckely you can create a global and/or a system wide ignore file.

So here is the global way of doing it (per user):

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

And here is the system way (per computer):

sudo touch /etc/gitignore
sudo git config --system core.excludesfile /etc/gitignore

So now you can add your changes to your ~/.gitignore_global or /etc/gitignore files once and ignore the rest.

Category: