Git 正确地忽略了我的目标文件夹(maven)中的所有内容,但文件夹“surefire-reports”除外。
我的.gitignore:
# Java
*.class
.idea/
# Package Files
*.jar
*.war
*.iml
*.ucls
target/
但是 target\surefire-reports\ 中的文件仍然由 git 跟踪。查看 git 状态输出:
# On branch connectionPane
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: target/surefire-reports/TEST-navalwar.ConsolePlayerTest.xml
# modified: target/surefire-reports/navalwar.ConsolePlayerTest.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# gitstatus.txt
no changes added to commit (use "git add" and/or "git commit -a")
target\ 中还有其他文件夹和文件,但 git 不跟踪它们!