gpt4 book ai didi

git - git 中的垃圾收集提交

转载 作者:IT王子 更新时间:2023-10-29 00:51:09 27 4
gpt4 key购买 nike

我有一些由 git subtree 创建的提交,我想要进行垃圾收集(更多的是为了了解可以收集什么以及为什么可以收集的任何实际目的)。

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

# 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)

这些是git gc documentation的地方可能包含引用的列表。

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

我错过了什么吗?或者是否有任何 git 管道命令可以检查所有这些引用?

最佳答案

每次我想删除松散对象时,我都使用以下命令:

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

关于git - git 中的垃圾收集提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14991916/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com