Git ignores files. 1. Three types of files are ignored by git: 1. The "version root directory /. git/info/exclude ", all the ignore rules in the global scope are written in the behavior unit in this file; 2. the effective ignore file within the local scope is. gitignore. This ignore file is only valid for objects in a level-1 directory. If a directory contains objects to be ignored, then you can create ignore files at the site where the directory is located. gitignore, and write the ignore rule in this ignore file, in the unit of behavior, one rule occupies one line; a special case is to create an ignore file under the root directory of the version library. gitignore. the gitignore ignore file is effective for the files in the root directory of the version library, and is equivalent to the ignore file in a global scope. git/info/exclude; 3. Manually specify an ignore file. The rules and syntax of the ignore file are the same as those of the first two types. You can specify any level of directory, you only need to add the corresponding path. The command to manually specify the file to be ignored is: git conf Ig -- global core. excludesfile/path//. gitignore and then manually create the ignore file in the corresponding location. gitignore, and write the ignore rules in the file. Note: The content format and syntax of the three types of ignore files are consistent. 2. Ignore the file rules: the ignore rule is valid for the file name. A: A blank line or A row starting with # is ignored. B: wildcards can be used: * any character ;? Single character; [abc] a, B, or c; [a-z0-9] indicates matching within a certain range; \ escape character ;! Indicates the reverse (not ignored), which is written before a rule. C: path separator "/". If the name after "/" is a directory, the directory and all files in the directory will be ignored. If the name after "/" is a file, the file will not be ignored. For example: /name if the name is a directory, all files under the directory name and name will be ignored; if the name is a file, the file will not be ignored; D :. you can ignore yourself in the gitignore file. You only need to write your own name. E: A (ROW) ignore rule is only valid for files in a directory, the file in the subdirectory in this directory is invalid. F: The ignore rule for one (ROW) can only be valid for a single file (ignore a single specified file). For example :*. a # ignore all. a is a suffix file ;! Lib. a # Do not ignore the file lib. a;/TODO # Only the TODO files under the directory are ignored, and the TODO files in the subdirectory are not ignored; build/# All files under the build directory are ignored; doc /*. txt # Only all txt files under doc/are ignored, but txt files under doc/subdir/are not ignored;