git clone更改文件修改时间 [英] git clone changes file modification time

查看:402
本文介绍了git clone更改文件修改时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 git clone ... 命令克隆一个git存储库时,本地存储库中所有克隆的文件的修改时间都与日期和时间相同,而<$发出了c $ c> git clone 命令。



是否可以用每个文件的实际修改时间克隆远程git存储库

解决方案

Git 不记录时间戳,因为它是 Distributed VCS(这意味着您计算机上的时间可能与我的不同:没有时间和日期的中心概念)



在此答案中解释了不记录元数据的官方论点。 / p>

但是您可以找到尝试恢复有意义日期的脚本,一个(或同一个想法的简单版本)。


When I clone a git repository using "git clone ..." command all cloned files in my local repository have the same modification time with date and time when git clone command was issued.

Is there a way to clone remote git repository with actual modification time for each file?

解决方案

Git does not record timestamp for the files, since it is a Distributed VCS (meaning the time on your computer can be different from mine: there is no "central" notion of time and date)

The official argument for not recording that metadata is explained in this answer.

But you can find scripts which will attempt to restore a meaningful date, like this one (or a simpler version of the same idea).

这篇关于git clone更改文件修改时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆