git - 克隆特定的提交位桶

标签 git bitbucket

_

我在 bitbucket 中有一个项目,我想从中克隆特定的提交
这些是提交,我希望没有最后两个

enter image description here

但在 SourceTree 中我看不到提交号 b6981f91fb876a只是最后一个号码 da84f64 enter image description here

我想因为最后3个挤在一起,我该怎么办?

最佳答案

yes I want the whole repository except the last 2 commits, I don't need it, so how I can specific that cloning?



正常的方法是:
  • 克隆一切
  • checkout 一个新分支(或重置当前分支)到 HEAD~2
    git checkout -b newBranch @~2
    

  • 除此之外:
  • shallow clone允许您获得最后 n 次提交(这不是您想要的)
  • sparse checkout是关于子文件夹(不是子提交)
  • fetch single commit不会得到所有的提交,而是一些。

  • I have partners in project but we got bug in the last 2 commits



    因此,使用 SourceTree:
  • 克隆 repo(正常克隆)
  • 选择您想要工作的提交:双击提交以检查它,然后单击“分支”。

  • 创建新分支后,工作并添加新提交,然后推送您的错误修复分支。

    关于git - 克隆特定的提交位桶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39813578/

    相关文章:

    git - Mercurial -> 保留提交哈希的 Git 迁移

    bash - 如何通过 API 对 Bitbucket Pull Request 进行 Markdown/HTML 评论?

    git - 有什么好的、跨平台的、Mac、Win32、*nix、Git GUI 客户端吗?

    git filter 分支到 git filter repo 的转换

    ios - 无法添加带有私有(private)存储库 url 的源

    git - 无法推送到远程分支,无法解析到分支

    docker - 推送后如何使用 BitBucket Pipelines 更新 Google Cloud Compute Engine 实例?

    git - 将批处理文件部署到引导 Windows EC2 实例时出现问题

    node.js - 从 git checkout 构建 yeoman 项目

    git - git fetch不起作用-但 checkout 有效