# Experimentation with the `.git`  folder

Today afternoon I was going through the documentation of git to learn more about git commands. All of a sudden I stumbled upon a valuable piece of information. When we create a git repository using the `git init` command, 
a new folder called .git gets created which contains the following directories and files. The .git folder appears following when there's zero staging and commits.

![initgitJPG.JPG](https://cdn.hashnode.com/res/hashnode/image/upload/v1660719790769/1VOAzLKFF.JPG align="left")

The moment you make your first commit, the .git folder appears like this with some extra files and folders.

![g.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1660720447377/mjTgBNpCs.jpg align="left")

There was a section in the documentation that described what each file in the .git folder stores. I actually went through the text and decided to share what I learned. So, let's get started!!!

**1.`hooks`** - It stores client-side or server-side hook scripts. So, basically, we can say that hooks are scripts. Whenever an event occurs in a git repository, these scripts automatically execute. For example, when we perform a commit operation one of the scripts in the `hooks` folder executes to complete the commit operation. I actually experimented by deleting the `hooks` folder from .git but it still worked the same without any malfunction.

**2.`info`**- It stores the information about everything that you put into the .gitignore file.

**3.`objects`** - It is a database for your repository. Everything that we do inside our repository like the creation of the new file, committing, etc that information is stored in the `objects` directory. I experimented and found that every time you make a commit new subdirectories get created in the `objects` directory.If you delete your `objects` folder all of your commit info will be gone. I deleted my `object` directory where and hit the `git log` command it showed me something like this- all my commit info was lost.

![obj.JPG](https://cdn.hashnode.com/res/hashnode/image/upload/v1660803825826/9BCibELpM.JPG align="left")

**4.`refs`** - This directory stores information about the head and tags.

**5.`config`** - It is used to store configuration for the repository. I deleted the config file and ran the `git status` command it showed me something like this

![config.JPG](https://cdn.hashnode.com/res/hashnode/image/upload/v1660804764623/Kh06HEVCJ.JPG align="left")

**6.`Description`** - It is used by the GitWeb program.

**7.`HEAD`**- It stores the information about the branch you have currently checkout to.

I figured out `hooks`, `objects`, and `config` are most sensible so better not touch them.






