Search code examples
c#model-view-controllervisual-studio-2015gitignoreasp.net-mvc-5.1

What I need to consider by createing gitignore file for mvc5


I want to use a gitignore file for my latest MVC-5 project but I don't know what I need to consider.

I found in the web this site:

I never used before github or other sites to store and share my project :)

Thanks for the answers


Solution

  • As Cameron Tinker said in their answer, the purpose of the .gitignore file is to let git know that you want to exclude files from source control - the most common reason to do so being that they are generated (based on the files you do check in).

    The one you found, or this one (probably with the same contents) are good starting points if you work with Visual Studio - just download the file, and put it in the root of your repository with the name .gitignore (yes, that's a dot at the start). If you start seeing files in your repository which you want to exclude, just add a line to .gitignore.

    If you're not working with Visual Studio, and only have project.json and some .cs files, you might as well start simple. In one of my projects, I have

    PS> cat .gitignore
    bin
    obj
    artifacts
    .vscode
    

    and that's it. If I stumble on more things I want to exclude, I add them.