GITGIT – Ignoring files

GIT – Ignoring files

there are 2 ways to ignore files in git – these files will not be tracked. If you use an IDE, it will create some settings of its own inside your git directory. If they are not ignored, then they will be pushed to your remote server and will be pulled when someone pulls from your repo.

Ignoring Files withe  a global config file

Just create a global config file and place it anywhere you like ( recommended is to put it in your home directory )

I am going to create it in this dir – /home/Desktop/naveen/GIT

cd /home/Desktop/naveen/GIT
touch .gitignore_global

put all the rules you want in here to ignore files

i typically ignore all hidden files with these 2 lines in the file


To see how rules work and samples refer to these links


Next we need to add it to gits global config using this command

please give the full path name to the global ignore file

git config --global core.excludesfile  /home/Desktop/naveen/GIT/.gitignore_global

Ignoring Files from every Repo  

if you want to exclude different files per Repo, then all you need to do is create a file called .gitignore and put it in whatever path you want inside your Repo


Categories: GIT


No Comments Yet. Be the first?

Post a comment

Your email address will not be published. Required fields are marked *