Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
676 views
in Technique[技术] by (71.8m points)

What is a dangling commit and a blob in a Git repository and where do they come from?

I'm looking for the basic information on dangling commits and blobs.

My repository seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'.

What are these things? Where did they come from? Do they indicate anything unusual (good or bad) about the state of my repository?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.

Eventually (conditionally, according to the git gc man page) it will perform garbage collection and clean these things up. You can also force it by invoking the garbage collection process, git gc.

For more information about this, see Maintenance and Data Recover on the git-scm site.

A manual run of GC will by default leave two weeks prior to the runtime of this command as a safety net. It is in fact encouraged to run the GC occasionally to help ensure performant use of your Git repository. Like anything, though, you should understand what it is doing before destroying those things that may be important to you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...