如果强制Git提交文件,如果它被识别为未更改 [英] How to force Git to commit a file if it is recognized as unchanged
本文介绍了如果强制Git提交文件,如果它被识别为未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个二进制文件,其中有
- 完全相同的大小
- 完全相同的修改日期
- 完全相同的创建日期
但是
如果我用另一个替换一个文件,
git无法识别此文件为已更改。
文件系统:NTFS,操作系统:Windows 7,Git版本:1.9.0
(我的解决方法是编辑这个新文件以获得新的修改日期,但我保留相同的内容)
如何强制Git提交新文件?
解决方案
您可以随时做到这一点
git rm --cached< file>
git add< file>
这应该将新文件放到索引中,而不管以前有什么。
I have 2 binary files, which have
- exactly same size
- exactly same modification date
- exactly same creation date
but
- different content
If I replace one file with the other, git does not recognize this file as changed.
Filesystem: NTFS, OS: Windows 7, Git Version: 1.9.0
(my workaround is to edit this new file to get a new modification date but I keep same content)
How can I force Git to commit the new file?
解决方案
You could always do
git rm --cached <file>
git add <file>
This should put the new file into the index regardless of what was previously there.
这篇关于如果强制Git提交文件,如果它被识别为未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文