Answer a question

The file https://github.com/tanafaso/tanafaso-frontend/blob/master/lib/net/api_interface/azkar/requests/get_categories_response.dart is not ignored by git, and that's expected as I have only listed azkar/ in .gitignore which means that only the directory azkar/ under the root should be ignored.

However, git check-ignore thinks that the file will be ignored and that it satisfies the pattern azkar/.

➜  azkar-frontend git:(master) ✗ git check-ignore --verbose lib/net/api_interface/azkar/requests/get_categories_response.dart
.gitignore:20:azkar/    lib/net/api_interface/azkar/requests/get_categories_response.dart

Answers

From https://git-scm.com/docs/gitignore#_pattern_format :

If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.

Nothing is said about directory level unlike

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore…

Hence the pattern azkar/ matches any directory "azkar" deep in the directory hierarchy.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐