如何从GitHub项目获得某些提交 [英] How to get certain commit from GitHub project

查看:115
本文介绍了如何从GitHub项目获得某些提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从 GitHub 下载Facebook API。通常,我只需点击下载标签下载最新的源代码。在这种情况下,我需要一个较旧的提交: 91f256424531030a454548693c3a6ca49ca3f35a ,但我不知道如何从该提交中获得整个项目...



有人可以请告诉我如何做到这一点?



(顺便说一句,即时消息在Mac上,不知道这是否有任何区别)。


<首先,使用git克隆版本库,例如:

  git clone git://github.com/facebook/facebook-ios-sdk.git 

那下载整个版本库的历史记录,以便切换到任何版本,然后切换到新克隆的版本库:

  cd facebook-ios-sdk 

...并使用 git checkout< COMMIT> ; 改变到右侧提交:

  git checkout 91f25642453 

这会给你一个警告,因为你不再是一个分支,而是直接切换到特定版本。 (这被称为分离HEAD状态)。由于听起来好像你只想使用这个SDK,而不是积极地开发它,所以这不是你需要担心的事情,除非你有兴趣发现更多关于git如何工作的信息。


I need to download the Facebook API from GitHub. Normally, I just click on the 'Downloads" tab to download the latest source code. In this case, I need an older commit: 91f256424531030a454548693c3a6ca49ca3f35a, but I have no idea how to get the entire project from that commit...

Can someone please tell me how to do this?

(BTW, im on a mac. Don't know if that makes any difference).

解决方案

First, clone the repository using git, e.g. with:

git clone git://github.com/facebook/facebook-ios-sdk.git

That downloads the complete history of the repository, so you can switch to any version. Next, change into the newly cloned repository:

cd facebook-ios-sdk

... and use git checkout <COMMIT> to change to the right commit:

git checkout 91f25642453

That will give you a warning, since you're no longer on a branch, and have switched directly to a particular version. (This is known as "detached HEAD" state.) Since it sounds as if you only want to use this SDK, rather than actively develop it, this isn't something you need to worry about, unless you're interested in finding out more about how git works.

这篇关于如何从GitHub项目获得某些提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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