我的 .gitignore
文件似乎被 Git 忽略了 - .gitignore
文件是否已损坏? Git 期望哪种文件格式、语言环境或文化?
我的.gitignore
:
# This is a comment
debug.log
nbproject/
git status
的输出:
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# debug.log
# nbproject/
nothing added to commit but untracked files present (use "git add" to track)
我希望 debug.log
和 nbproject/
不出现在未跟踪的文件列表中。
我应该从哪里着手解决这个问题?
最佳答案
即使到目前为止您还没有跟踪这些文件,即使在您将它们添加到 .gitignore
之后,Git 似乎也能够“知道”它们。
警告:首先提交或存储您当前的更改,否则您将丢失它们。
然后从 Git 存储库的顶级文件夹运行以下命令:
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
关于git - .gitignore 被 Git 忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11451535/