D
D
DarkByte20152018-07-11 10:47:18
git
DarkByte2015, 2018-07-11 10:47:18

Why is gitignore not working?

The .gitignore says "web/index.php", but this file is stubbornly not ignored. Tell me how to be?
PS "git rm -r --cached ." did not help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2018-07-11
@DarkByte2015

If this file has already been added to the version control system, then you need to remove it from there or roll back to a commit where this file did not exist yet. Adding it to the ignored list will not make it disappear from there.

Y
Yaolegol, 2019-05-03
@yaolegol

git filter-branch --force (so that the directory is not removed from the hard drive)
git filter-branch --tree-filter "rm -rf PATH" HEAD
where PATH is the path to the file/folder
How do I remove a directory in Git?
https://help.github.com/en/articles/removing-sensi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question