When the gitignore file has consecutive ^M$ special symbols, running the "git check-ignore '<pathname>/'" command will prompt '<pathname>/' exists (even if it doesn't exist), and prompts '<pathname>/' in the last consecutive ^M$ location. My English is very bad, please forgive me.
environment: windows10 git version 2.23.0.windows.1
for example:
.gitignore normal view --------------------------- ### Android template # Built application files *.apk *.ap_ *.aab
# Files for the ART/Dalvik VM *.dex
# Java class files *.class
# Generated files bin/ gen/ out/ release/
# Gradle files .gradle/ build/ ---------------------------
.gitignore detailed view
---------------------------
1 ### Android template^M$
2 # Built application files^M$
3 *.apk^M$
4 *.ap_^M$
5 *.aab^M$
6 ^M$
7 # Files for the ART/Dalvik VM^M$
8 *.dex^M$
9 ^M$
10 # Java class files^M$
11 *.class^M$
12 ^M$
13 # Generated files^M$
14 bin/^M$
15 gen/^M$
16 out/^M$
17 release/^M$
18 ^M$
19 # Gradle files^M$
20 .gradle/^M$
21 build/^M$
---------------------------project directory --------------------------- drwxr-xr-x 1 L 197121 0 11月 8 16:13 ./ drwxr-xr-x 1 L 197121 0 11月 8 16:12 ../ drwxr-xr-x 1 L 197121 0 11月 8 16:13 .git/ -rw-r--r-- 1 L 197121 226 11月 8 16:17 .gitignore drwxr-xr-x 1 L 197121 0 11月 8 16:12 .idea/ ---------------------------
run git check-ignore command --------------------------- $ git check-ignore -v '.idea/' .gitignore:18: .idea/ $ git check-ignore -v '.idea/sfsf/' .gitignore:18: .idea/sfsf/ ---------------------------