简体   繁体   English

摆脱悬垂斑点的最安全方法是什么

[英]What is the safest way to get rid of dangling blobs

git version 1.7.11.4

Is there any safe way to get rid of the dangling blobs/commits.是否有任何安全的方法来摆脱悬垂的 blob/提交。 I just worry in case I accidentally delete something.我只是担心万一我不小心删除了一些东西。

git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (13017/13017), done.
dangling blob 6b9542f29f534b377f9ad280d6d342a4114146ec
dangling blob 0d1779fc8bac49a45b216e1891345b7f69ee068c
dangling blob f8ae5bad210ac84d66d28cb723dcad5b3f325bff
dangling blob e84f8c37c239bc591a52b1169669fb8f593b39b2
dangling blob 5d605b5d6ca0c7cb8d1bc05607eefada2092219b
dangling blob 9363f36de455d504cba3e78fbfb0cb133292fe55
dangling blob 0df63ff9133cc21b45a417958cb012689ebdc4cd
dangling commit fe764632c9d283b558f1326c56f940b3f3aea931
dangling blob b67bedfd9682fbc84f38d44b5112087dff004adc

I have tried the following:我尝试了以下方法:

git gc --auto
git clean -f

First of all, there is a reflog which keeps track of all branch history.首先,有一个reflog可以跟踪所有分支历史记录。 By default it is 90 days (gc.reflogExpire).默认为 90 天 (gc.reflogExpire)。 Also there is gc.reflogExpireUnreachable which is 30 days.还有gc.reflogExpireUnreachable是 30 天。 So, if you have made reset on a branch the dangling commit will be here for 30 days accessible via fsck .因此,如果您在分支上进行了reset ,悬空提交将在此处保留 30 天,可通过fsck访问。

Also, there is a garbage collector prune settings, which drop dangling objects after 2 weeks by default ( gc.pruneExpire config setting).此外,还有一个垃圾收集器修剪设置,默认情况下会在 2 周后丢弃悬空对象( gc.pruneExpire配置设置)。

Regarding how to wipe out objects from a repository you could read other questions here, eg How to REALLY delete a git branch (ie remove all of its objects/commits)?关于如何从存储库中清除对象,您可以在这里阅读其他问题,例如如何真正删除 git 分支(即删除其所有对象/提交)?

clean removes untracked files from your working copy, it is unrelated to the blobs/commits. clean从您的工作副本中删除未跟踪的文件,它与 blob/提交无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM