问题描述
我已经在我的机器上设置了一个本地 git.当我初始化 git 时,我添加了预编译的库和二进制文件.但是,现在在我的开发过程中,我不想间歇性地检查这些文件.我不想从 repo 中删除这些文件.在我完成开发之前,有什么方法可以不跟踪这些文件.(我想我不能使用 .gitignore,因为它只适用于那些不在 git 中的文件.我想暂时禁用文件跟踪.)
I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any way to not keep a track of these files till I complete my development. (I think I can not use .gitignore as it works only for those files which are not in git. I want to temporarily disable tracking of files.)
推荐答案
git update-index 应该做你想做的
这将告诉 git 你想开始忽略对文件的更改git update-index --assume-unchanged path/to/file
This will tell git you want to start ignoring the changes to the filegit update-index --assume-unchanged path/to/file
当您想再次开始跟踪时git update-index --no-assume-unchanged path/to/file
这篇关于暂时从 git 中取消跟踪文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!