Almost everyone heard about and used GIT. It is a good idea to know better tools we use so I found 3 ways to ignore file/folder you may not know. Interested?
This is the most popular way to remove some items for your repository. Just add the .gitignore file to your project and it just works. You need to remember that if you add the file to ignoring list it will be applied to every collaborator.
If you want to exclude items from your repository but you do not want it should affect others work, you should use global .gitignore file. You need to create a file outside your repository (generally in your home folder) and tell GIT he should read ignored file list from the file. For example, we created the file and called it
git config --global core.excludesfile ~/.gitignore_global
The –global parameter tells GIT we want to affect it to every repository.
Not everyone knows that there is a file in you .git folder where you can put your unwanted files. And yes – the file is .git/info/exclude. It will work generally like .gitignore but it will affect only this single repository and will not be sent to remote repository.
I think it can be a bit confusing. That’s why I created a simple table with a quick overview.
|.gitignore||Globa .gitignore||Secret .git/info/exclude file|
|Range||Single repository||All repositories||Single repository|
|Saved in repo?||Yes||No||No|
Now you have more mystic knowledge about GIT. I hope you will find it useful.