Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

When I open the Git GUI, I get a popup message that refers to loose objects. I did git gc and that removed the message.

What are loose objects and how could I prevent this from occurring again?

1 Answer

0 votes
by (50.2k points)

Let’s say there is a SHA -920cae53e0f622d6804f063c04a93dbc3a11b7ca

And this will be stored at

.git/objects/92/0cae53e0f622d6804f063c04a93dbc3a11b7ca

Note: There is a split in the first two characters that will improve the performance of the file system. As of now not all the objects are stored in the same directory.

Objects that are stored above are referred to as Loose objects.

When you start up with your repo, you mostly have loose objects. As the number goes higher, it becomes inefficient and they will be stored in a pack file. Such objects are called packed objects.

 git gc

is what you run to pack-objects (Usually loose objects that are not needed and few weeks old are also removed and with --prune=<date> option. Like when you amend a commit. The old commit object is no longer needed.)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...