Best way to create a .gitignore for .NET projects

Best way to create a .gitignore for .NET projects

Try `dotnet new gitignore` on your CLI πŸ€–

Jul 24, 2022Β·

1 min read

Table of contents


dotnet new gitignore

Built-in since .NET Core 3.0 🀯

Story behind

I just started learning .NET, so I'm creating a lot of projects, it's been a great experience so far πŸš€

I usually publish my projects as open source on Github, so it wouldn't look nice if they include obj/, bin/, or other specific editor things included. Storing such files is messy and even dangerous in some cases.

Example: You could forget to clean from those artifacts your secret password ⚠

Coming from other ecosystems, I used to visit to solve this problem, but it's something I always looked to optimize.

This problem is solved elegantly on .NET 🀩

I recommend you to visit the remaining documentation of dotnet new, it includes many great and useful things that I will be documenting little by little in future blogs!

Good luck!