我使用.git/info/exclude跟踪了一些文件夹和文件:
doc
*.txt
doc/*.txt
doc/somefile.txt
Run Code Online (Sandbox Code Playgroud)
但是git status表示它仍然被跟踪:
$ git st
# On branch dev
# 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: doc/somefile.txt
Run Code Online (Sandbox Code Playgroud)
其他奇怪的事情ls-files表明它没有跟踪:
$ git ls-files --ignored --exclude-from=.git/info/exclude
doc/somefile.txt
$ touch /tmp/xxx
$ git ls-files --ignored --exclude-from=/tmp/xxx
$
Run Code Online (Sandbox Code Playgroud)
我在git版本1.8.1.5
所以我得出结论,我可能会误解某些事情或做错事.有什么好主意吗?
由于您在本地忽略了存储库中的文件,因此您需要告诉git您忽略它们
git update-index --assume-unchanged <files to forget>
Run Code Online (Sandbox Code Playgroud)