With .gitignore
, only untracked files are ignored.
Once the file has been added, change to that file are not ignored.
In this case, you should use assume-unchanged
or skip-worktree
instead.
git update-index --assume-unchanged -- wp-config.php
or
git update-index --skip-worktree -- wp-config.php