Github uses. gitignore to ignore specified files

Source: Internet
Author: User

Github uses. gitignore to ignore specified files
. Gitignore

Github provides the. gitignore function, which allows you to specify which files can be managed. The specific method is to create a. gitignore under the root directory of Version Management (the same as the. git folder.

Application Instance

The project contains three clist. h clist. c main. c files. After compilation and execution, three clist. o main. o main files are generated. These three files do not require version management. Therefore, you need to ignore these files. After you use git stauts to view them, you can find that these three files are in the Untracked files status. In fact, we want to ignore him.

To solve this problem, follow these steps:

 
S1: touch. gitignore # create the gitignore secret file S2: vim. gitignore # edit the file and add the specified file # The following is the content of my gitignore file # ignore the gitignore file. gitignore # ignore the suffix. o and. a file *. [oa] # display the file main with the specified ignore name as main
 

File. gitignore format specification:

  • # Annotation
  • You can use the regular expression used by shell for pattern matching.
  • The last match with "/" indicates the directory to be ignored.
  • Use! (For example, the directory contains test. a and the gitignore file contains *. [oa]. If you add it to the file! Test. a indicates that the files with the extension name. a or. o are ignored)

After the. gitignore file is configured, run the git status Command and you will find that the three files are no longer Untracked files, and the function of ignoring the specified files is completed.

GitHub Tutorials:

GitHub tutorials

Git tag management details

Git branch management

Git remote repository details

Git local Repository (Repository) Details

Git server setup and Client installation

Git Overview

Share practical GitHub tutorials

GitHub details: click here
GitHub: click here

This article permanently updates the link address:

Related Article

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.