🌤

Create a gitignore file with dotnet cli

dotnetcligitgithub
Loading...
 

Published on

April 5, 2022

When I create a new project on GitHub, the first thing that I add in the initial repository is the .gitignore file (often for VisualStudio) and then I copy that file from another solution on my pc and I commit it.

Image description

But time to time, I add some files that I don't want on my repo. Since a while, I found the perfect solution: create the .gitignore files with the dotnet cli.

Create the .gitignore with the dotnet cli

Not many people know that the dotnet cli provides a command to create a .gitignore file, practically perfect.

In the root folder of your project, you can launch the command below from your favorite terminal application or from the terminal inside Visual Studio or Visual Studio Code.

dotnet new gitignore

This command will create a perfect .gitignore in your folder with a lot of settings to ignore unnecessary files, not only for Visual Studio but also for Visual Studio Code and JetBrains products.

You can find the latest version of the file at the official repository.

{% embed https://github.com/github/gitignore/ %}

React, comment and follow on