# How Git Works Internally

### To understand properly please go through basic [Click here for Basic](https://basicofgitwithranjan.hashnode.dev/what-is-git-and-how-does-it-work?showSharer=true)

> .git folder is the hidden folder inside your current folder to view folder just follow the steps
> 
> step 1 Go to configure Editor
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769541815590/6ac7e012-60f5-43b9-bce6-632b0813fca7.png align="center")

> step 2 Go to Text Editor and open files: Exclude and remove \*\*/.git from Exclude
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769542323204/4c680444-9336-4106-8b4d-cdd601afabb1.png align="center")

## First question arises in mind that why this git folder exist ?

> The git folder is present inside the current folder because to keep the track of the changes that have made in the current working folder
> 
> It not only track the changes ,it also keep the record who is the author ,who has commited it and when the change where commited also the message during commit

### Lets discuss this with different command one by one to verify and check what is actually inside it

### git branch

> if you run this command you will get on which branch the your are working currently
> 
> ```plaintext
> C:\Users\ranja\Desktop\git demo> git branch
> * master
> ```
> 
> it return master from **<mark>refs/heads/master</mark>**
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769623224929/8fbef0dd-30d4-4c47-a144-9f87dd3a88d7.png align="center")

### cd .git

> this command take you in the .git folder through terminal
> 
> ```plaintext
> C:\Users\ranja\Desktop\git demo> cd .git  
> ```

### ls

> This command show you what are the things inside it **<mark>just have a look the image of .git folder</mark>**
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769622590692/5b579595-e5cc-41df-b2b7-e2e48fec2f79.png align="center")
> 
> As you can look in the image it contain different folder and files

###   
cd refs

> Lets go deep into what does it store in **<mark>refs folder</mark>**
> 
> ```plaintext
> C:\Users\ranja\Desktop\git demo\.git> cd refs
> C:\Users\ranja\Desktop\git demo\.git\refs> ls
> 
> Mode                 LastWriteTime         Length Name
> ----                 -------------         ------ ----
> d-----        25-01-2026     01:00                heads
> d-----        24-01-2026     12:04                tags
> 
> C:\Users\ranja\Desktop\git demo\.git\refs> cd heads
> C:\Users\ranja\Desktop\git demo\.git\refs\heads> cat master 
> 4ed24b1c7485d0244eaf4d44795252201db74cb3
> ```
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769623302664/b59c0813-4f69-49f5-b75c-e50b7ebc403a.png align="center")
> 
> so it means the master file is the **hexadecimal code of your head node**

### cd object

> The object folder keeps every nodes of linked list which all the different data is store
> 
> ```plaintext
> C:\Users\ranja\Desktop\git demo\.git> cd objects
> C:\Users\ranja\Desktop\git demo\.git\objects> 
> C:\Users\ranja\Desktop\git demo\.git\objects> ls
> Mode                 LastWriteTime         Length Name
> ----                 -------------         ------ ----
> d-----        24-01-2026     12:11                1c
> d-----        25-01-2026     00:05                3b
> d-----        24-01-2026     12:54                4d
> ```
> 
> *Always remember that Git names this folder using the first two characters of the hexadecimal code of that node.*
> 
> ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769625068836/9c70549b-a397-4a67-b7ad-ce65a26c39a0.png align="center")
> 
> so each node have an folder in the objects folder

## New Question arise what are store in the nodes

> | Git object | Stores |
> | --- | --- |
> | **Blob** | File content |
> | **Tree** | File names + blob hashes |
> | **Commit** | Snapshot + metadata |
> 
> ```plaintext
> C:\Users\ranja\Desktop\git demo\.git\objects>  git cat-file -p 4ed24b1c7485d0244eaf4d44795252201db74cb3
> tree 58452bad2a67d0862fbef6dc61e8b59b8d692348
> parent 4dc2b6e2f63508e66dbd2ccacb8679275aa1029c
> author 01Ranjan <ranjankumar459688@gmail.com> 1769279805 +0530
> committer 01Ranjan <ranjankumar459688@gmail.com> 1769279805 +0530
> 
> commit all at once
> ```
> 
> so now i think it is clear what is inside the .git folder

## To learn basic [Click here](https://basicofgitwithranjan.hashnode.dev/what-is-git-and-how-does-it-work?showSharer=true)
