In this article, we’ll dive into Git internals by going through a real example. If you don’t have your terminal open already, do so, fasten your seatbelts, and let’s go!
You have probably already initialized an empty Git project using git init
, but have you ever wondered what this command does?
Let’s create an empty folder and initialize an empty Git project. This is how the official Git documentation describes git init
:
“This command creates an empty Git repository — basically a
_.git_
directory with subdirectories for_objects_
,_refs/heads_
,_refs/tags_
, and template files. An initial_HEAD_
file that references the HEAD of the master branch is also created.”
If we inspect the folder’s content, we’ll see the following structure:
$ tree -L 1 .git/
.git/
├── HEAD
├── config
├── description
├── hooks
├── info
├── objects
└── refs
We’ll cover some of the objects later on.
#software-engineering #programming #software-development #github #git