Internals

the .git directory serves as the git repository

In Git terminology, the git repository is the .git directory managed by git. It is a hidden directory that lives at the root of the project. It stores all versioning data.

Because the directory stores all the project's data, we sometimes conflate it with the project directory itself, the one that lives locally and that contains both the working tree and the git repository proper.

enable git versioning in a project

The git init command creates the .git repository and enables git commands.

git init

.git directory content

files and directories

COMMIT_EDITMSG
FETCH_HEAD
HEAD
ORIG_HEAD
config
description
index
packed-refs

hooks/
info/
logs/
objects/
refs/

project specific configuration

the configuration file lives at .git/config

open .git/config

per user configuration

We may configure git at the user-level on a given computer. The configuration file is .gitconfig and lives in the home directory

code ~/.gitconfig
code ~/.gitattributes

git config user.name
git config user.email

git config user.name "John"
git config user.email "a@b.co"
earlymorning logo

© Antoine Weber 2025 - All rights reserved

Internals

the .git directory serves as the git repository

In Git terminology, the git repository is the .git directory managed by git. It is a hidden directory that lives at the root of the project. It stores all versioning data.

Because the directory stores all the project's data, we sometimes conflate it with the project directory itself, the one that lives locally and that contains both the working tree and the git repository proper.

enable git versioning in a project

The git init command creates the .git repository and enables git commands.

git init

.git directory content

files and directories

COMMIT_EDITMSG
FETCH_HEAD
HEAD
ORIG_HEAD
config
description
index
packed-refs

hooks/
info/
logs/
objects/
refs/

project specific configuration

the configuration file lives at .git/config

open .git/config

per user configuration

We may configure git at the user-level on a given computer. The configuration file is .gitconfig and lives in the home directory

code ~/.gitconfig
code ~/.gitattributes

git config user.name
git config user.email

git config user.name "John"
git config user.email "a@b.co"