Don't Ignore .gitignore



Someone reached to me saying .gitignore file is not ignoring the bin, obj and other user files in a visual studio project. When I checked the project I noticed gitignore file was created once the complete project is created, compiled and pushed. Due to this reason the .gitignore is not tracking the unwanted files unnecessary, so every time the push happens all unnecessary files are getting pushed to repository.

To solve this issue I had to use below git command to remove the unwanted files/folders from Cache from all folders, so that gitignore can track the files successfully.

git rm -r --cached .vs

In above command '.vs' is sample folder name.

From this exercise the learning is, it is always a good practice to add .gitignore to repository after initializing it. So, "Please don't ignore .gitignore".

Thank you.