Anyone who has used GitHub knows that the. gitignore file exists, but there are still some things to be aware of in actual use. Especially for new users, errors may occur if they do not pay attention to it.
I. How does GitHub selectively ignore specific files? 1. Global settings
Generally, to upload a project, a file is generated under the root directory of the project. git folder (implemented by the GIT init command), in. there is an exclude file in the GIT/INFO/folder, which describes the features of files that do not need to be uploaded to the remote end. It is generally represented by regular expressions.
The syntax of the exclude file is easy and not described.
2. Local Settings
The. Ignore file in a specific directory defines the features of files that do not need to be uploaded to the remote end. The directory and all the files that meet the features under the subdirectory will not be synchronized to the remote end .. The format of the ignore file is similar to exclude.
Ii. Notes 1. cache Problems
If the file has already been cached, it will not be affected by the above global settings and local settings. In this case, you need to execute the following command
git rm --cache
2. Ignore gitignore itself
You can also ignore yourself in. gitignore.