.git';无法停止在文件中跟踪更改

.git';无法停止在文件中跟踪更改,git,command-line,github,terminal,Git,Command Line,Github,Terminal,git正在跟踪我对.gitignore中的文件所做的更改 文件结构: .gitignore wp-config.php .gitignore的内容: wp-config.php 当我更改wp config.php,然后运行git status时,我看到它已被修改: alex$ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update w

git正在跟踪我对
.gitignore
中的文件所做的更改

文件结构:

.gitignore
wp-config.php
.gitignore
的内容:

wp-config.php
当我更改
wp config.php
,然后运行
git status
时,我看到它已被修改:

alex$ 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:   wp-config.php
#
alex$git状态
#论分行行长
#未为提交而暂存的更改:
#(使用“git add…”更新将提交的内容)
#(使用“git签出--…”放弃工作目录中的更改)
#
#修改:wp-config.php
#

如何停止跟踪此文件?我想把它放进
.gitignore
就足够了。

使用
.gitignore
,只会忽略未跟踪的文件

添加文件后,不会忽略对该文件的更改

在这种情况下,您应该使用
假定未更改
跳过工作树

git update-index --assume-unchanged -- wp-config.php


其他文件呢,我需要像这样添加所有其他文件和文件夹吗?而不是添加git忽略?
git update-index --skip-worktree -- wp-config.php