垃圾收集提交git [英] Garbage collect commits in git

查看:129
本文介绍了垃圾收集提交git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些由 git subtree 创建的提交,我想要进行垃圾收集(更多的目的只是为了理解收集的内容和原因)。



我已经检查过这些提交没有被以下方式引用:

 #在任何reflog 
> git reflog --all --no-abbrev-commit | grep< hash>
(无输出)

#在任何分支中,本地或远程
> git分支 - 包含< hash>
(无输出)
> git分支-r --contains< hash>
(无输出)

#在任何标签
> git标签 - 包含< hash>
(无输出)

#在当前索引
> git rev-list HEAD | grep< hash>
(无输出)

#在来自过滤分支
>的引用中, ls .git / refs / original /
(文件夹不存在)

这些是 git gc文档列出的地方可以包含引用。



仍然给定的提交在 git gc 后仍然存在。



我错过了什么吗?或者是否有任何git plumbing命令检查所有这些引用?每当我想删除松散对象时,我使用以下命令:

  rm -rf .git / refs / original / * 
git reflog expire --all - expire-unreachable = 0
git repack -A -d
git prune


I have some commits created by git subtree that I want to have garbage collect (more that any practical purpose just to understand what and why can get collected).

I have already checked that these commits are not referenced the following ways:

# In any reflog
> git reflog --all --no-abbrev-commit | grep <hash>
(no output)

# In any branch, local or remote
> git branch --contains <hash>
(no output)
> git branch -r --contains <hash>
(no output)

# In any tag
> git tag --contains <hash>
(no output)

# In the current index
> git rev-list HEAD | grep <hash>
(no output)

# In references from filter-branch
> ls .git/refs/original/
(the folder does not exist)

These are the place that git gc documentation lists that could contain references.

Still the given commits still exist after git gc.

Am I missing something? Or is there any git plumbing command that checks all this references?

解决方案

Every time I want to delete loose objects, I use the following commands:

rm -rf .git/refs/original/*
git reflog expire --all --expire-unreachable=0
git repack -A -d
git prune

这篇关于垃圾收集提交git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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