Which files should I include in .gitignore
when using Git in conjunction with Visual Studio Solutions (.sln
) and Projects?
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- VS2017 RC - The following error occurred when tryi
相关文章
- 请教Git如何克隆本地库?
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
As mentioned by another poster, Visual Studio generates this as a part of its .gitignore (at least for MVC 4):
Since your project may be a subfolder of your solution, and the .gitignore file is stored in the solution root, this actually won't touch the local database files (Git sees them at
projectfolder/App_Data/*.mdf
). To account for this, I changed those lines like so:Here is what I use in my .NET Projects for my
.gitignore
file.This is pretty much an all MS approach, that uses the built in Visual Studio tester, and a project that may have some TFS bindings in there too.
I know this is an old thread but for the new and the old who visit this page, there is a website called gitignore.io which can generate these files. Search "visualstudio" upon landing on the website and it will generate these files for you, also you can have multiple languages/ides ignore files concatenated into the one document.
Beautiful.
Credit to Jens Lehmann for this one - if you keep source directories separate to your compiler project files and build output, you could simplify your .gitignore by negating it:
You don't say what language(s) you're using, but the above should work for C++ projects.
There is a shortcut in Visual Studio, because it supports Git out of the box in 2015 or above. For new solutions (or some which don't have
.git
folder) use source control features in Solution Explorer:Right-click on your solution and select
Add Solution to Source Control...
item in the popup menu.It automatically initializes
.git
repository, adds.gitignore
with necessary things to your solution and even.gitattributes
file (line endings, etc.).The text will appeared in the VS console:
Done!
There's an online tool which allow you to generate .gitignore file based on your OS, IDE, language, etc. Take a look at http://www.gitignore.io/.
On 8/20/2014, here's the file that is generated for Visual Studio + Windows.