To avoid cluttering your repository with unnecessary files, you can add one or more .gitignore files. This will keep the repository lighter and make it easier to transfer.

The file will apply the rules to the directory where it resides and subdirectories. Note that the ignore file has to be committed and don't effect already committed files.

The simplest ignore file for .NET projects should include the following entries:


If you use MSTest, you should add a line with TestResults too.

It's pretty normal to add lines for various development tools you use. Our advice is to put such rules in the .git/info/exclude file, as it's specific to your system and not all developers.