[英]Git thinks every file modified because of timestamp difference — how to fix?
我正在2个Windows服务器之间移动存储库,因此我将整个存储库压缩到旧服务器上,然后将其解压缩到新服务器上-没有其他更改。
但是,这两个服务器具有不同的时区,因此新服务器上的所有文件时间戳都恰好关闭了3小时(时区之间的差异)。
结果,Git认为每个文件都被修改了,即使没有修改。
如何使Git忽略此问题和/或重置它认为的时间戳记?
我需要它来正确显示当前没有修改过的文件。
我尝试了git reset --hard
但这没什么区别。
关于SO的其他问题似乎解决了行尾或文件权限问题,在这里不是这种情况。 找不到解决时区/时间戳差异的任何内容。
谢谢!
您应该使用git bundle来复制存储库。
样例代码:
// Create git bundle with the name of project.bundle
// --all is for packing all the local branches as well
git bundle create project.bundle --all
将project.bundle
转移到目标计算机B。
因为此捆绑包不需要提取任何现有对象,所以可以通过直接从机器B克隆来在机器B上创建新的存储库:
git clone -b <branch name> file.bundle <path to repository location>
git remote add origin <url>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.