Why is .gitignore not working?

my problem does not coincide with Why does gitignore not work in this case? and .gitignore no work

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

i means 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") 
+4
source share
1 answer

.gitignore ignores only .gitignore files. Once you started tracking the file (as you did with files/conf.php ), it will not be ignored.

You can use git rm --cached files/conf.php to delete a file from git without actually deleting it from the file system. Once you commit this, the file will be ignored properly.

+11
source

Source: https://habr.com/ru/post/1434301/


All Articles