如何git捆绑完整的回购

菲利普·奥克利

我需要将完整的存储库转移到新的非联网计算机上,最好将其作为单个文件实体。git的捆绑允许git fetchgit pull操作风格在sneakernet环境,但似乎假设你已经在目标计算机上回购的工作版本。

什么是正确的调用权:

  1. 捆绑当前仓库中的所有分支
  2. 在目标目录上启动新的仓库,即正确安装根提交

我已经向上游发送了一个补丁以进行澄清:

`git clone` can use any bundle created without negative refspecs
(e.g., `new`, but not `old..new`).
If you want to match `git clone --mirror`, which would clone other
refs such as `refs/remotes/*`, use `--all`.
If you want to provide the same set of refs that a clone directly
from the source repository would get, use `--branches --tags` for
the `<git-rev-list-args>`.

因此$ git bundle create repo.bundle --branches --tags最适合克隆。

$ git bundle create repo.bundle --all 将提供源计算机的镜像,包括它的远程引用。

雅库布·纳伦斯基(JakubNarębski)

什么是正确的调用权:

  • 捆绑当前仓库中的所有分支

简单:

$ git bundle create repo.bundle --all

repo.bundle是您要创建的捆绑文件的名称。请注意,它--all不包括远程跟踪分支……就像普通克隆一样。

  • 在目标目录上启动新的仓库,即正确安装根提交

首先,clone就是init+ fetch(+ administrativia)。

其次,您可以在可使用存储库URL的任何地方使用捆绑文件,因此您可以简单地clone从捆绑文件中使用:

$ git clone repo.bundle

这将创建repo为git存储库。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章