In the process of collaborative development code management, some temporary files, configuration files, or file generation are often encountered. These files vary with the development end, if you use git add. if you include all the files in the GIT library, frequent changes and pushes will occur, which will cause inconvenience in development.
Git can easily help us solve this problem, that is, to create a project file filtering rule.
Git provides two filtering mechanisms: one is global filtering, which applies to all git; the other is the filtering rules used for a project. I prefer the second type.
Take a project of mine as an example. This project is developed using. net, the. config file, including the generated bin/debug, bin/release files, and so on. I hope that it will not be added to git management.
Create the. gitignore file Vim. gitignore in the Code directory. The content is as follows:
# Filter database files, SLN solution files, configuration files *. mdb *. LDB *. sln *. config # filter folders debug, release, objdebug/release/obj/
Call git Add. and execute git commit.
Problem:. gitignore is only applicable to files not added to the GIT library. If it has already been added, you need to remove the git rm and then re-commit it.
Use gitignore in git