暂时从git中删除文件 [英] Untrack files from git temporarily
问题描述
我在我的机器上安装了一个本地git。当我初始化git时,我添加了预编译的库和二进制文件。但是,现在在我的开发过程中,我不想间歇地检查这些文件。我不想从回购中删除这些文件。在完成我的开发之前,有没有办法不保留这些文件的轨道? (我想我不能使用.gitignore,因为它只适用于那些不在git中的文件,我想暂时禁用跟踪文件。)
git update-index 应该做你想做的事
这会告诉git你想开始忽略对文件的更改
git update-index --assume-unchanged path / to / file
当你想再次开始跟踪时, $ b git update-index --no-assume-unchanged path / to / file
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 should do what you want
This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file
When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file
Github Documentation: update-index
这篇关于暂时从git中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!