GitHub uses. Gitignore to ignore specified files

Source: Internet
Author: User
Tags using git

. gitignore

GitHub offers. Gitignore This feature allows you to specify which files can be managed without your own. The specific method is to create a. Gitignore under the root directory of the version management (with the. git folder sibling).

Application examples

The project has clist.h clist.c main.c three files, compiled after execution, generated three files clist.o main.o main. These three files do not need to be versioned, so you need to ignore these files, using Git stauts view, found that the three files are also in the untracked files state. And we're actually trying to ignore him.

Use the Gitignore file to work around this problem, as follows:

S1:      touch  . Gitignore     #创建gitignore隱藏文件  S2:      vim    . Gitignore     #编辑文件, adding the specified file           #下面是我的gitignore文件的内容           #忽略gitignore文件           . Gitignore           #忽略后缀名为. O and. A Files            *. [ OA]           #显示指定忽略名称为main的文件           main

Format specification for file. Gitignore:

    • #为注释
    • Pattern matching can be done using regular expressions used by the shell
    • Match mode last followed by the "/" description to ignore is the directory
    • Use! Reverse (for example, the directory contains TEST.A, and the Gitignore file contains *. [OA], if added in the file! TEST.A indicates that the suffix named. A or. o is ignored except for the test.a file)

After configuring the. gitignore file, executing the git status command will find that the three files are no longer untracked files, and have completed ignoring the specified file.

I'm the dividing line of the king of the Land Tiger.

Reference: http://blog.csdn.net/cscmaker/article/details/8553980

GitHub uses. Gitignore to ignore specified files

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.