简体   繁体   中英

.gitignore fails to ignore a file

I have a file, foo.php and it is located inside the bar foler, which is in the root folder of the project.

It was recently deleted by mistake, but I have re-created it, its path inside the folder is bar/foo.php

I have a row in .gitignore , stating that:

bar/foo.php

The path is correct, but if I run a

git status

the file is shown as a new file. How can I ignore it, if .gitignore fails to ignore it in its current version?

I am developing under Windows 7.

Thanks for any input.

Did you stage it for commit before you added it to the .gitignore file?

Try the following command:

git rm --cached bar/foo.php

After that it should not be showing anymore when you run a git status if it is in the .gitignore correctly.

The File : bar/foo.php

Might still be in the git indexing. You can remove it from indexing by:

git rm --cached bar/foo.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM