Ignoring files with Git


Git ignore allows you to specify files or folders that you don’t want to track with git. Some of the files that we don’t want to track are files that differ from one developer to another. They might be files resulting from a build. Other files might be artifacts that will change every time you build your project.

For example in Asp.Net projects, all of the dll files go inside the bin folder. Some of the dll files might be coming from a public nuget repository while others are private. Adding the bin folder to the .gitignore file will notify Git to ignore that folder and all of its contents.

If you are using Git, you can create a new file called “.gitignore” and place it in the root of your project. Now add [Bb]in/ to the first line of the file and save it. From now on, any files that reside in Bin or bin folder will be ignore or untrack by Git. There is a public repository at github called gitignore that has common settings for different languages. There is one for Visual Studio and you can find the project here. You can take a look at those settings and copy those to your project.

To read the official Git documentation, go to the gitignore page. I hope this article helps you gain more knowledge about Git and its features.