her*_*ron 0 windows git ignore
我有完整的dir结构

这里是.gitignore的内容
conf.php
问题是,当我更改内容conf.php并尝试提交某些内容时,GIT会conf.php再次检测到已更改的文件.实际上它必须被忽略.
我已经承诺了一次.我想从现在开始忽略它.我错过了什么?
我试过以下:
从缓存中删除它 git rm --cached conf.php.
但现在,当我重新扫描项目时,它想要conf.php移除.

这不是我想要的.
我想将它保存在远程仓库并忽略本地仓库的未来(从现在开始)变化.
Git不会忽略已经提交的文件的更改.
Git忽略,忽略你的回购中的噪音,例如:
$ git init
$ mkdir tmp
$ touch tmp/file1
$ touch tmp/file2
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# tmp/
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)
如果.gitignore文件被修改为忽略tmp目录:
$ echo "tmp" > .gitignore
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)
tmp目录内容不再列出 - 但列出了.gitignore文件(因为我刚创建它并且文件本身不被忽略).
承诺,没有列出任何变化:
$ git add .gitignore
$ git commit -v -m "addding git ignore file"
[master (root-commit) d7af571] addding git ignore file
1 file changed, 1 insertion(+)
create mode 100644 .gitignore
$ git status
# On branch master
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
现在,对.gitignore文件的任何更改都将显示为挂起的更改,tmp目录之外的任何新文件都将显示为未跟踪的文件,并且将忽略tmp目录中的任何更改.
如果你已经将conf.php添加到你的git repo,git正在跟踪该文件.当它改变时,git 会说它有未决的变化.
这类事情的解决方案是不提交你不想跟踪的文件.相反,您可以做的是提交默认文件,例如:
$ mv conf.php conf.php.default
$ # Edit conf.php.default to be in an appropriate state if necessary
$ git commit -v -m "moving conf.php file"
$ cp conf.php.default conf.php
Run Code Online (Sandbox Code Playgroud)
现在,您对conf.php所做的任何更改都不会显示为未分级的更改.