What is the .git folder?

.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)

Leave a Comment