Git 忽略当前更改

标签 git

我正在为 android 构建内核,并且我已经设置了 git,因此它会忽略所有生成的 .o 文件。我在构建之前进行了第一次提交(更改了一些 selinux 内容),一切顺利。

我构建了我的内核,当我尝试运行另一个提交时,它列出了数千个 .c.h 文件,这些文件在构建过程中发生了更改,但我没有真的想提交,因为没有必要,我显然不能排除这些文件,因为如果我稍后修改这些文件,我就无法提交它们。

关于如何忽略构建期间修改的所有文件有什么想法吗?

最佳答案

git update-index --assume-unchanged 文件

来自 git update-index 的文档:

When this flag is specified, the object names recorded for the paths are not updated. Instead, this option sets/unsets the "assume unchanged" bit for the paths. When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index

要撤消并重新开始跟踪,
git update-index --no-assume-unchanged 文件

关于Git 忽略当前更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39188391/

相关文章:

git - git flow 开发和 master 分支永远不会再 merge (永远并行)吗?

git - 如何获取服务器上运行的git的版本号?

git - 如何使用 git 同时处理多个不同版本的文件?

svn - HEAD 和 SVN Master 之间的 Git 差异

git - 如何解决所有有利于刚刚 pop 的存储的 merge 冲突?

git - TFS Git 项目中的依赖项目 VNEXT 构建

git - 如何从旧提交创建新的 Git 分支?

node.js - 修改示例 Hello World Node.js 代码在 Google Compute Engine 中未生效

Git 克隆 fsync 错误,权限被拒绝

git - 尝试备份 Gitlab 时出错