06/11/2014 - GIT, LINUX
The global .gitignore file with set of rules is created to ignore files and folders in every git repositories in your system so it applies to all the projects you're working on. Files to be globally ignored must not be indexed before otherwise global ignore won't work for them.
As we can see below, there is a useless folder .idea/
which needs to be ignored.
inanzzz@inanzzz:~/project$ git branch
* develop
master
inanzzz@inanzzz:~/project$ git status
On branch develop
Untracked files:
(use "git add..." to include in what will be committed)
.idea/
nothing added to commit but untracked files present (use "git add" to track)
To make sense, I'm using a descriptive name which is .gitignore_global
so you're free to name it as you want. Create the file in your home directory, put .idea/
into it, save it and exit.
inanzzz@inanzzz:~$ sudo nano .gitignore_global
Setup global configuration file "core.excludesfile" to point to your new global .gitignore_global file.
inanzzz@inanzzz:~$ echo $HOME
/home/inanzzz
inanzzz@inanzzz:~$ git config --global core.excludesfile /home/inanzzz/.gitignore_global
As we can see below, .idea/
folder has been ignored completely.
inanzzz@inanzzz:~/project$ git branch
* develop
master
inanzzz@inanzzz:~/project$ git status
On branch develop
nothing to commit, working directory clean