Setting rules ignored by git

  • The API file and schema.json file in GraphiQL are too large and belong to the dynamically generated file. The configuration ignores the items.

  • Learn more about the setting rules for git ignore. In the .gitignore file, the syntax of the ignore rules for each line is as follows:

The space does not match any file, can be used as a delimiter, you can use the backslash to escape the file identification comment at the beginning, you can use the backslash to escape

! The pattern identifier at the beginning is negative and the file will be included again. If the parent directory of the file is excluded,! Will not be included again. You can use the backslash to escape / end the pattern to match only the folder and the contents under the folder path, but it does not match the file / pattern matching items and directories at the beginning If a pattern does not contain a slash, it matches Relative to the content of the current .gitignore file path, if the pattern is not in the .gitignore file, it will match the multi-level directory relative to the project root directory **, which can be at the beginning, middle, and end? Universal match single character [] Universal match single character List

Common matching examples:

bin /: Ignore the bin folder under the current path, all contents in this folder will be ignored, do not ignore the bin file / bin: ignore the bin file in the root directory / .c: ignore cat.c, do not ignore build / cat.c debug / .obj: ignore debug / io.obj, not debug / common / io.obj and tools / debug / io.obj  / foo: ignore / foo, a / foo, a / b / foo, etc. / / b: ignore a / b, a / x / b, a / x / y / b, etc./bin/run.sh: do not ignore the run.sh files in the bin directory * .log: ignore all .log files config.php: ignore the current path of the config.php file. The gitignore rule does not take effect

.gitignore can only ignore files that have not been tracked. If some files have been included in the version management, modifying .gitignore is invalid.

The solution is to delete the local cache (change to the untracked state) before submitting:

git rm -r --cached. git add. git commit -m 'update .gitignore' You want to add a file to Git, but found that it cannot be added because the file is ignored by .gitignore:

$ git add App.class The following paths are ignored by one of your .gitignore files: App.class Use -f if you really want to add them.

If you really want to add this file, you can force it to be added to Git with -f:

$ git add -f App.class

Or you find that there may be a problem with .gitignore, you need to find out which rule is wrong, you can use the git check-ignore command to check:

$ git check-ignore -v App.class .gitignore:3:*.class App.class

Git will tell us that the rule on line 3 of .gitignore ignores the file, so we can know which rule should be revised.

Guess you like

Origin www.cnblogs.com/liuxiaokun/p/12680077.html