# Inside Git: How It Works and the Role of the .git Folder

## What is the `.git` folder — and why does it exist?

When you run:

```bash
git init
```

Git creates a hidden folder called `.git`.

Everything Git knows about your project’s history, branches, commits, and tracked files lives inside this folder. If you delete the `.git` directory, Git loses all version control information, and your project becomes a normal folder again.

The purpose of the `.git` folder is to allow Git to:

* Track the **entire history** of a project
    
* Store **snapshots** of files over time
    
* Manage **branches, tags, and HEAD**
    
* Ensure **data integrity** using cryptographic hashes
    
* Perform fast operations like branching, merging, and checkout
    

## Inside the .git/ folder

The `.git/objects` folder is where **Git stores everything permanently**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768317726396/c9b746a9-cf65-4bd1-8c81-de1b3ec732f4.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768317605217/a6fdfbf5-5bb2-4a39-b912-779c95de8dd9.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768649219093/0d0ec155-b665-4608-abc9-f3f85587d94f.png align="center")
