Part II. Fundamentals of Git
The following chapters highlight how Git manages files, explain the importance of the index and how it relates to this process, and take a detailed look at the commit object and the important role that branches play in a Git repository.
Before we proceed, we would like to explain why we chose to discuss these topics in this order.
In âGit Internals: Concepts at Workâ, we dissected the available objects within the Git object store. Letâs look at how the objects are created and when they establish links with each other.
First we will create an empty directory and inspect the content using the tree
command:
$mkdir myrepo && cd myrepo
$git status
fatal: not a git repository (or any of the parent directories): .git $tree .git
.git [error opening dir] 0 directories, 0 files
Since this is not a Git repository, there is no .git directory. Next, we will initialize an empty Git repository and reinspect the directory content:
$git init -b main
Initialized empty Git repository in /myrepo/.git/ $tree .git
.git âââ HEAD âââ config âââ description âââ hooks â âââ applypatch-msg.sample â âââ commit-msg.sample â âââ fsmonitor-watchman.sample â âââ post-update.sample â âââ pre-applypatch.sample â âââ pre-commit.sample â âââ pre-merge-commit.sample â âââ pre-push.sample â âââ pre-rebase.sample â âââ pre-receive.sample â âââ prepare-commit-msg.sample ...
Get Version Control with Git, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.