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: