我已经尝试过什么由有关如何忽略文件以前的问题#1建议:Ignore files that have already been committed to a Git repositorygit的添加/删除承诺并不仅仅是忽略的.gitignore忽略文件
什么建议:
git rm -r --cached .
我使用的命令:
git rm -r --cached application/config/config.php
//i only want to ignore this one file
不幸的是,当我做git add.
然后git commit
我的config.php文件是从存储库中删除了,而不仅仅是忽略。
我有一个.gitignore文件以在我的根目录下,它包含以下列表项:
application/config/config.php
可能有人能帮助我理解为什么这个config.php文件正在删除和公正不被忽视?
这里就是我的git的状态显示:
$ git status
# On branch master
# 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: .gitignore
# modified: application/config/config.php
#
no changes added to commit (use "git add" and/or "git commit -a")
谢谢你,
添
在做'add'和'commit'之前,'git status'报告是什么? – Ali 2012-04-02 14:35:52
hi Ali,请参阅上面修改的问题,谢谢! – 2012-04-02 14:50:19
您已修改文件。试试'git checkout - application/config/config.php' – mschonaker 2012-04-02 14:56:36