git update-index --assume-unchanged和git reset [英] git update-index --assume-unchanged and git reset

查看:141
本文介绍了git update-index --assume-unchanged和git reset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是这种情况:

在我的工作目录中,我有许多我编辑过的文件(我们称之为A,B,C)。然后,我在这些文件上运行 git update-index --assume-unchanged 。现在 git status 返回空白。好。

现在,如果我执行 git reset --hard ,文件A,B的内容,和C,在我编辑它们之前还原为内容并且假定 - 不变它们。

有没有办法阻止git实际恢复文件A,B和C,并简单地忽略它们?



谢谢,



解决方案

您可以这样做:

  git update-index --skip-worktree A 


Here is the scenario:

In my working directory, I have a number of files (let's call them A,B,C) that I've edited. I then ran git update-index --assume-unchanged on those files. Now git status returns blank. Good.

Now, if I do a git reset --hard, the contents of the files A,B, and C, revert back to the contents before I've edited them and "assume-unchanged" them.

Is there a way to stop git from actually reverting files A,B, and C, and simply ignore them?

Thanks,

Ken

解决方案

You can do:

git update-index --skip-worktree A

这篇关于git update-index --assume-unchanged和git reset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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