Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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")
like image 501
thinke365 Avatar asked Sep 14 '12 20:09

thinke365


1 Answers

.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.

like image 114
Lily Ballard Avatar answered Oct 09 '22 19:10

Lily Ballard