如何解压 git 存储库的所有对象?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16972031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:21:13  来源:igfitidea点击:

How to unpack all objects of a git repository?

gitunpack

提问by Chico Sokol

How can I unpack allobjects of a pack file?

如何解压缩包文件的所有对象?

I've just cloned a remote repository, so my local repository currently doesn't contain any loose object, only a .pack and a .idx files.

我刚刚克隆了一个远程存储库,所以我的本地存储库当前不包含任何松散对象,只有一个 .pack 和一个 .idx 文件。

I've tried running git unpack-objects < .git/objects/pack/pack-.pack, but nothing happens.

我试过跑步git unpack-objects < .git/objects/pack/pack-.pack,但没有任何反应。

I'm doing something wrong? Is there any other command to do that?

我做错了什么?有没有其他命令可以做到这一点?

回答by William Seiti Mizuta

You need to move the pack objects outside the .git/objects/packdirectory before using the command. However, the pack files need to be inside the repository.

.git/objects/pack在使用该命令之前,您需要将包对象移动到目录之外。但是,包文件需要在存储库中。

For example, create a directory name SAMPLEin your project's root. Then, move the pack files to SAMPLEdirectory. After that, inside the repository without the pack files, use the command git unpack-objects < SAMPLE/*.pack. Git will generate all objects inside .git/objectsdirectory of your repository.

例如,SAMPLE在项目的根目录中创建一个目录名称。然后,将包文件移动到SAMPLE目录。之后,在没有包文件的存储库中,使用命令git unpack-objects < SAMPLE/*.pack. Git 将在.git/objects您的存储库目录中生成所有对象。