如何在Git中从指定日期克隆远程(GitHub)存储库 [英] How to in Git, clone a remote (GitHub) repository from a specifed date

查看:1344
本文介绍了如何在Git中从指定日期克隆远程(GitHub)存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从某个日期克隆一个git仓库。即使这是不可能的。是否可以克隆git仓库,然后将其滚动回特定日期?



示例:我的存储库自2010年5月以来已更新,但我希望从6月5日起获得版本。我想运行以下命令:

  git clone git@github.com:projectfolder -date 06-05-2010 


解决方案

克隆存储库会为您提供整个提交历史记录所有源代码。



您只需回滚 git log 并在您的目标日期找到所需的提交。运行 git checkout SHA 其中 SHA 是提交哈希将为您提供该日期的源代码状态。 / p>

编辑:

git log --since = 2010-06-05 - 直到= 2010-06-06 将有助于缩小范围!


I'm trying to clone a git repository from a certain date. Even if this is not possible. Is it possible to clone the git repository and then roll it back to a certain date?

Example: my repository has been updated since May 2010, but I'd like to get the version from June 5th. I'd like to run the following command:

git clone git@github.com:projectfolder -date 06-05-2010

解决方案

Cloning the repository will give you the entire commit history of all the source code.

You need only scroll back through git log and find the desired commit on your target date. Running git checkout SHA where SHA is the commit hash will give you the state of the source code on that date.

edit:

git log --since=2010-06-05 --until=2010-06-06 will help narrow it down!

这篇关于如何在Git中从指定日期克隆远程(GitHub)存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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