如何在filter-branch --subdirectory-filter之后从我的repo中删除不需要的对象 [英] how can I remove the unwanted objects from my repo after filter-branch --subdirectory-filter

查看:230
本文介绍了如何在filter-branch --subdirectory-filter之后从我的repo中删除不需要的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

I'm using

git filter-branch --subdirectory-filter dir/name -- --all

构建一个只包含与该目录/名称相关的历史记录的仓库。在我做这个过滤器之前,我把原始的repo(这是非常大的)克隆到tmp目录中。在过滤分支之后,回购看起来就像我想要的那样,但有一个例外:它似乎仍包含原始回购的所有对象,即使它们没有显示在git log中。

to build a repo that only has history relating to that dir/name. Before I do the filter, I clone the original repo (which is very much bigger) into a tmp dir. After the filter-branch, the repo looks just how I want it, with one exception: It seems to still contain all the objects from the original repo even though they're not shown in "git log."

如何完全删除所有这些不需要的对象?

How can I remove all those unwanted objects completely?

我试过这样的事情:

git reflog expire --expire=now --all
git gc --aggressive --prune=now

我很清楚,我不知道他们为什么仍然存在,或者意味着要删除它们,但我确实希望。有些可能与我有关的信息是我曾经在我的源代码仓库上做过一次git repack -a,并且似乎将该packfile复制到新的仓库中。似乎我应该仍然可以做我想做的事情。

It's clear to me that I don't know why they're still there or what it means to remove them, but I'd sure like to. A bit of possibly related information working against me is that I had done a git repack -a on my source repo a while back and it seems to copy that packfile over to the new repo. Seems like I should still be able to do what I want though.

推荐答案

filter-branch还将备份参数保存在.git / refs / original,你必须在gc'ing

filter-branch also keeps backup refs in .git/refs/original, which you'll also have to remove before gc'ing

这篇关于如何在filter-branch --subdirectory-filter之后从我的repo中删除不需要的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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