首页 > 解决方案 > GIT - Ignore file again

问题描述

This is my .gitignore file:

*.iml
*.conf

So I forced to add a file named settings.conf and now I want Git stop tracking changes on this file.

I tried with git rm --cached settings.conf but it removes the file from git repository. I want this file to stay on git repository but do not detect changes.

I also tried git update-index --assume-unchanged settings.conf and got : fatal: Unable to mark file settings.conf

Thanks in advance.

标签: gitgithub

解决方案


您正在寻找命令git update-index --assume-unchanged settings.conf

如果要提交对文件的更改,则需要使用 切换此设置git update-index --no-assume-unchanged settings.conf,进行提交,然后重复第一个命令。


推荐阅读