Today when working i needed to ignore to some files from getting checked in to my git repository. So, i created a .gitignore file in my projects root directory with the list of files and filetypes that i wanted to ignore. So, now when i do git add ., the stuff i have in my .gitignore is not added to the index, so wont get checked in.
However,this works only for files which were not currently being tracked by git. For example if i wanted to ignore files of type x, then any untracked files of type x will be ignored by git, but the files of type x already under version control will still remain in the index and hence get checked in during the next commit. The way around this is to run the following command after we have created our .gitignore file:
git rm -r --cached .
This removes everything from the index, so we can now run:
git add .
, and the index will now not have the previously tracked files we wanted to ignore and the next commit will remove these ignored files from the servers repository too.
My Networks



