Alex Alex - 1 year ago 71
Git Question

.gitignore doesn't stop changes being tracked in files

Changes I make to a file that's within my

are being tracked by git.

File structure:


Contents of


When I change
, and then run
git status
I see that it has been modified:

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

How to I stop tracking this file? I thought putting it in
would be enough.

Answer Source

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


git update-index --skip-worktree -- wp-config.php
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download