我正在为 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/