暂时从 git 中取消跟踪文件 [英] Untrack files from git temporarily

查看:22
本文介绍了暂时从 git 中取消跟踪文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的机器上设置了一个本地 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 file
git update-index --assume-unchanged path/to/file

当您想再次开始跟踪时
git update-index --no-assume-unchanged path/to/file

Github 文档:更新索引

这篇关于暂时从 git 中取消跟踪文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆