git - 从 bundle 备份恢复 git 存储库

标签 git backup restore

我像在 How to backup a local Git repository? 中创建了我的 git 存储库的备份建议的 与

git bundle create /tmp/foo-all --all

我可以看到所有引用都在那里,包括由 git-svn 创建的远程引用。 现在我不知道如何将这个包再次恢复到本地存储库。 我很确定我已经做过一次了。我尝试了 git-clone 但这只给了我一个存储库,其中包含我的备份包作为远程存储库。

我也试过

git init
git bundle unbundle /tmp/foo --all 

但这只是列出了所有的引用...

验证包给出:

$ git bundle verify $somewhere/foo.bundle 
The bundle contains 12 refs
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/master
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/remotes/git-svn
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HEAD
The bundle requires these 0 ref
$somewhere/foo.bundle is okay

最佳答案

简答:

$ git bundle verify $somewhere/foo.bundle
$ git clone $somewhere/foo.bundle
Cloning into 'foo'...
Receiving objects: 100% (10133/10133), 82.03 MiB | 74.25 MiB/s, done.
Resolving deltas: 100% (5436/5436), done.
$ cd foo
$ git status
...

Lazy Badger 是这么说的,但它在最后一段。 :)

关于git - 从 bundle 备份恢复 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9807367/

相关文章:

git - 如何识别 Jenkins 管道中的 merge 提交?

git - 如何提交到远程git仓库

backup - 如何在 Apache Sling 中执行正确的备份

kubernetes - 在 GKE 集群中安装 Velero 时无法拉取镜像 "velero/velero-plugin-for-gcp:v1.1.0"

ios - 在本地备份核心数据,并从备份中恢复 - Swift

git - 清理工作树时出现 checkout 错误

git - NodeJS/Jenkins/GIT 和 Jenkins Slave 作为 Web 服务器

hadoop - <问> 如何备份和恢复HDFS

sql-server - SQL Server : Database stuck in “Restoring” state with PHP

linux - 来自 TAR 输出的 Grep 模式