.git is initialized by git init.
.git contains all information required for version control. If you want to clone your repo, copy .git is enough.
4 sub-directories:
hooks/ : example scripts
info/ : exclude file for ignored patterns
objects/ : all “objects”
refs/ : pointers to commit objects
4 files:
HEAD : current branch
config : configuration options
description
index : staging area
Here “object” includes:
blobs(files)
trees(directories)
commits(reference to a tree, parent commit, etc)
The .git folder contains all the information that is necessary for your project in version control and all the information about commits, remote repository address, etc. All of them are present in this folder. It also contains a log that stores your commit history so that you can roll back to history.
For more info, you can check the official website of git.