从打包文件还原git repo [英] Restore git repo from a pack file

查看:251
本文介绍了从打包文件还原git repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在接管一些项目,但是我没有适当的git repo,而是一个 pack-7dab97d983eeb36321c680bee7fde43688334f52.pack 文件.我可以从中恢复可用的git存储库吗?以及如何?

I am taking over some project, and I don't have a proper git repo but rather a pack-7dab97d983eeb36321c680bee7fde43688334f52.pack file. Can I restore a working git repository from it? And how?

推荐答案

pack文件仅包含提交,因此您没有分支名称,必须猜测它们.一个很好的起点是悬空提交.

pack file contains only commits, so you don't have branch names, you have to guess them. A good starting points would be dangling commits.

  • 创建一个空的存储库
  • 将包复制到.git/objects/pack/
  • 可能会索引包装(我不确定是否需要)
  • 运行git fsck --lost-found
  • 从找到的提示中挑选您可能的分支机构
  • create an empty repository
  • copy the pack to .git/objects/pack/
  • probably index the pack (I'm not sure if it needed or not)
  • run git fsck --lost-found
  • pick from found tips your probable branches

请注意,如果打包文件只是原始存储库中的几个文件之一,它将失败,因为它可能取决于您没有的对象

Note that it would fail if the pack file is only one of several from the original repository, as it may depend on objects which you don't have

这篇关于从打包文件还原git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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