thinke365
thinke365

Reputation: 1335

why .gitignore not works?

my issue is not the same as Why doesn't gitignore work in this case? nor .gitignore is not working

files/conf.php is already in .gitignore, but git status still shows its modification, why?

i mean this file should not be tracked if it is in .gitignore...

cat .gitignore
files/conf.php
[root@home blogmi]# 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:   files/conf.php
#
no changes added to commit (use "git add" and/or "git commit -a")

Upvotes: 5

Views: 1869

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185851

.gitignore only ignores untracked files. Once you've started tracking a file (as you've done with files/conf.php), it will not be ignored.

You can use git rm --cached files/conf.php to delete the file from git without actually deleting it from the filesystem. After you commit that, the file will start being ignored properly.

Upvotes: 11

Related Questions