Search code examples
gitgitignore

git doesn't stop tracking specific autogenerated file despite I excluded it in .gitignore and `.git/info/exclude`


Git doesn't stop tracking specific autogenerated file in the project. I have a specific file that autogenerated when the project run: platform/views/index.html. I have added it to .gitignore, to .git/info/exclude, run on it git rm --cached platform/views/index.html but every time it's recreated git keep asking me what do I want to do with it.

How can I cause git to stop tracking this file once and forever? Thank you.

My .gitignore file:

dump.rdb
*.DS_Store
.vscode
.sfdx
npm-debug.log
**/.idea
**/node_modules
.vs
**/.history
newrelic_agent.log
platform/api/modules/interactions/entity-mock.js
platform/views/

Solution

  • If you want to ignore all files in the directory, use:

    platform/views/**
    

    in the gitignore. If you just want to ignore the one file, use:

    platform/views/index.html
    

    The pattern platform/views does not match the file, so your current .gitignore is not ignoring the file.