Git operation: use. Gitignore to manage vs project

Time:2021-1-13

When using git to manage visual studio projects, we often encounter this situation:

The entire project folder has more than 100 m, while the source code only has more than 100 K. If all of them are added into git, 100m garbage will be generated during each compilation, and the size of GIT project will exceed 1g after 10 git submissions!

How to solve this problem? Very simple, create a text file named. Gitignore in the root directory of the warehouse, and then write the following content:

#Filter database files, SLN solution files and configuration files.mdb
*.ldb
*.sln
*.suo
*.config
Release/
obj/
.vs/

Then using git add. Will only add the source code!

Note: you can’t create a text file named. Gitignore in Windows environment, because it has no file name, only suffix. At this time, you need to use the VIM in Git bash to edit the file. The specific method is in my article:Learn how to use VIM – lyj00912 – blog Garden in 3 minutes