git - 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.
解决方案
您正在寻找命令git update-index --assume-unchanged settings.conf
如果要提交对文件的更改,则需要使用 切换此设置git update-index --no-assume-unchanged settings.conf
,进行提交,然后重复第一个命令。
推荐阅读
- javascript - 想在视频结束时删除视频播放器并加载我的功能
- bash - 如何使用选项设置期望脚本
- python - Odoo v11:自动升级 __manifest.py 中提到的所有模块
- python - Kivy:touch.ud 是什么意思
- c# - 按日期范围过滤对象
- java - 内部事务(REQUIRES_NEW)抛出异常时的外部事务回滚
- r - 计算日期之间的差异并为数据框 R 中的结果添加列
- bash - Ubuntu sed - 在 URL 中追加而不是替换
- css - 滚动条上的 CSS 绝对位置
- r - Create new variable for many columns in R