使用--depth = 1克隆树时,如何将<commit_hash>拉入头部?

时间:2019-03-17 23:52:46

标签: git

我尝试了3种不同的方法,所有方法均返回失败:

第一次尝试

git pull origin <\hash_here>

  

错误:服务器不允许请求未发布的对象   <\ hash_here>

第二次尝试

git checkout <\hash_here>

  

致命:引用不是树:<\ hash_here>

^我安静地理解了这个,因为它实际上不在树上

第三次也是最后一次尝试

git clone https://github.com/repo/repo.git --depth=1 -b <\hash_here>

  

警告:找不到要克隆的远程分支<\ hash_here>。

     

致命:在上游来源中找不到远程分支<\ hash_here>

如果有人可以引导我朝正确的方向发展,我还不确定如何进行git操作,而且我认为我的google-fu很弱。

1 个答案:

答案 0 :(得分:0)

首先使用git clone

从github克隆存储库。
git clone https://github.com/repo/repo.git

完成git克隆后,您可以创建git分支

git checkout -b <branchName>