Use gitignore in git

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.