What is the use of object directory in git?

0

Issue

I’m learning git currently and and I have a git repo where I can see a .git directory.

In that directory I can see certain files and folders which I can understand.

But there is one directory named objects. I couldn’t able to think of what they are for.

For example my objects directory has:

04  4a  5f  7a  e9  f2  info  pack

and for example if see the contents of 04 I can see a file named 12697515217f658b245149a986aba32fa98f38. I couldn’t able to see its contents, it been encrypted.

Can anyone say why the objects folders are for? Why a big hash no like 12697515217f658b245149a986aba32fa98f38?

In any case I can decrypt the contents of 12697515217f658b245149a986aba32fa98f38 and really see how git does its magic?

Thanks in advance.

Solution

In .git/object git stores it’s own internal warehouse of blobs, all indexed by SHAs.

Why a big hash no like 12697515217f658b245149a986aba32fa98f38?

It is some representation of a blobs tree. It’s faster and more comfortable for different file-systems to keeping all blob directories in that way.

In any case I can decrypt the contents of 12697515217f658b245149a986aba32fa98f38 and really see how git does its magic?

I really hope you can’t decrypt it (it is just compressed, not encrypted as @knittl fairly noticed in the comments).

If you are interested in what stores in .git directory have a look at that article http://gitready.com/advanced/2009/03/23/whats-inside-your-git-directory.html .

Answered By – ДМИТРИЙ МАЛИКОВ

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More