本文翻译自:Undo git update-index --assume-unchanged

The way you Git ignore watching/tracking a particular dir/file. 你Git忽略观察/跟踪特定目录/文件的方式。 you just run this: 你刚刚运行这个:

git update-index --assume-unchanged <file>

Now how do you undo it so they are watched again? 现在你如何撤消它,以便再次观看它们? (Let's call it un-assume.) (我们称之为取消。)


#1楼

参考:https://stackoom.com/question/1A9Qb/撤消git-update-index-assume-unchanged-file


#2楼

I assume (heh) you meant --assume-unchanged , since I don't see any --assume-changed option. 我假设(嘿)你的意思是--assume-unchanged ,因为我没有看到任何--assume-changed选项。 The inverse of --assume-unchanged is --no-assume-unchanged . --assume-unchanged的倒数是--no-assume-unchanged


#3楼

To get undo/show dir's/files that are set to assume-unchanged run this : 要获取设置为假定未更改的undo / show目录/文件,请执行以下操作

git update-index --no-assume-unchanged <file>

To get a list of dir's/files that are assume-unchanged run this : 要获取assume-unchanged的目录/文件列表,请执行以下操作

git ls-files -v|grep '^h'


#4楼

Adding to @adardesign 's answer, if you want to reset all files that have been added to assume-unchanged list to no-assume-unchanged in one go, you can do the following: 添加到@adardesign的答案,如果要将已添加到assume-unchanged列表的所有文件重置为一次性no-assume-unchanged ,则可以执行以下操作:

git ls-files -v | grep '^h' | sed 's/^..//' | sed 's/\ /\\ /g' | xargs -I FILE git update-index --no-assume-unchanged FILE || true

This will just strip out the two characters output from grep ie "h " , then escape any spaces that may be present in file names, and finally || true 这将只删除grep输出的两个字符,即"h " ,然后转义文件名中可能存在的任何空格,最后|| true || true will prevent the command to terminate prematurely in case some files in the loop has errors. || true循环中的某些文件有错误,则|| true将阻止命令提前终止。


#5楼

git update-index function has several option you can find typing as below: git update-index函数有几个选项你可以找到如下键入:

git update-index --help

Here you will find various option - how to handle with the function update-index. 在这里,您将找到各种选项 - 如何使用函数update-index处理。

[if you don't know the file name] [如果你不知道文件名]

git update-index --really-refresh

[if you know the file name ] [如果你知道文件名]

git update-index --no-assume-unchanged <file>

will revert all the files those have been added in ignore list through. 将还原所有已在忽略列表中添加的文件。

git update-index --assume-unchanged <file>

#6楼

If this is a command that you use often - you may want to consider having an alias for it as well. 如果这是您经常使用的命令 - 您可能也想考虑为它添加别名。 Add to your global .gitconfig : 添加到您的全局.gitconfig

[alias]hide = update-index --assume-unchangedunhide = update-index --no-assume-unchanged

After saving this to your .gitconfig , you can run a cleaner command. 将此保存到.gitconfig ,您可以运行更清洁的命令。

git hide myfile.ext

or 要么

git unhide myfile.ext

This resource was very helpful 这个资源非常有用

撤消git update-index --assume-unchanged file相关推荐

  1. Smart Git Assume Unchanged

    今天写代码提交文件的时候不小心用鼠标点击到 Toggle "Assume Unchanged"按钮,然后要Commit的文件就消失不见了. 用 git update-index - ...

  2. git fatal: index file smaller than expected

    为什么80%的码农都做不了架构师?>>>    由于git的index文件出错. 需要删除.git/index文件, 然后运行git reset,重新生成index文件. git r ...

  3. 如何撤消Git中的最新本地提交?

    我不小心将错误的文件提交给Git ,但是我还没有将提交推送到服务器. 如何撤消本地存储库中的那些提交? #1楼 我想撤消我们共享存储库中的最新五次提交. 我查找了要回滚的修订版ID. 然后我输入以下内 ...

  4. Git提交时提示‘The file will have its original line endings in your working directory’

    Git提交时提示'The file will have its original line endings in your working directory' Git出现错误 git add -A ...

  5. Unable to update index for central http://repo1.maven.org/maven2/

    http://blog.csdn.net/luoqiaozhen/article/details/5800418 Unable to update index for central http://r ...

  6. (转载)解决eclipse安装maven的问题:Unable to update index for central|http://repo1.maven.org/maven2...

    问题产生如下: 因为单位使用了过滤,访问Internet时,超过10M的内容就拒绝. 因为maven插件在初始时,需要下载Maven的index文件,这个文件比较大,有38M多,下载不成功. 所以造成 ...

  7. Kafka : FileNotFoundException索引文件丢失 xxx.index (No such file or directory)

    1.美图 2.背景 kafka不知道什么原因报错 WARN/data/kafka-logs/alipha.virusr-5/0090000090007751323.index(No such file ...

  8. 解决eclipse安装maven的问题:Unable to update index for central

    解决eclipse安装maven的问题:Unable to update index for central 参考文章: (1)解决eclipse安装maven的问题:Unable to update ...

  9. 撤消git pull,如何将repos带到旧状态

    有没有办法恢复或撤消git pull,以便我的源/ repos将进入git pull之前的旧状态? 我想这样做是因为它合并了一些我不想这样做的文件,但只合并了其他剩余的文件. 所以,我想要恢复这些文件 ...

  10. Vue打包后出错:Tip: built files are meant to be served over an HTTP server. Opening index.html over file

    1.使用命令npm run build打包vue项目之后提示 : Tip: built files are meant to be served over an HTTP server. Openin ...

最新文章

  1. 祝贺《WCF邮件通信系统》在高阳市场研究汇编第五期发表
  2. 随机从mysql中读取_如何实现MySQL表数据随机读取?从mysql表中读取随机数据
  3. 微服务框架 Go-Micro 集成 Nacos 实战之服务注册与发现
  4. Python操作git
  5. android 怎么换行,android textview 怎么换行?
  6. C++ 类的静态成员(static)
  7. Android Animation实现元素在屏幕上按照指定轨迹运动,以及出现NullPointerException的解决方案
  8. bzoj#4722-由乃【倍增,抽屉原理,bitset】
  9. 微信小程序源码下载链接
  10. 完全卸载HDP和Ambari
  11. Python使用AES算法进行加解密
  12. 漂流瓶html5,微信又搞事情?漂流瓶下线,居然还有这些新功能...
  13. VS2017产品秘钥
  14. 小米推送,华为推送,个推,阿里云推送集成(服务端JAVA开发)
  15. 优雅编程之项目开发中的22点编码小建议(三十七)
  16. 多个APP合并为一个APP开发的实现方案
  17. 推荐 | 给好奇者的一些优秀个人博客
  18. 优秀logo,最基础的设计技巧(三)
  19. 基于Android的健康宝体检app介绍(一)
  20. 新书来了 | 邀您一起来看看

热门文章

  1. 关于XUtils框架细解
  2. tomcat在conf/Catalina/localhost目录下配置项目路径
  3. 使用Speech SDK 5.1文字转音频
  4. catalyst 6500 安装配置
  5. DCOM 遇到错误“登录失败: 未知的用户名或错误密码
  6. 文件同步工具GoodSync
  7. Angular 自定义模块
  8. Docker容器服务发现方案
  9. 【贪心】 【HDU 5821】 Ball
  10. 安装db2 提示不是有效的win32应用程序?