DEV Community

Cover image for Understanding How Git Internals Work?: PART-2
Ganesh Kumar
Ganesh Kumar

Posted on

Understanding How Git Internals Work?: PART-2

Hello, I'm Ganesh. I'm working on FreeDevTools online, currently building a single platform for all development tools, cheat codes, and TL; DRs — a free, open-source hub where developers can quickly find and use tools without the hassle of searching the internet.

In this blog I am going to explain how Git is initialized with an example.

What Git Actually Does?

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

If we look at the core of it, it's just a tool to track content.

Initially, I thought git is software that copies files to a local folder, and it tracks the files on changes, but it does not do that.

Let's Understand by Doing

I will create a simple project, say priority-tasks.

Initialize Git repository


git init priority-tasks

cd priority-tasks

ls .git
branches  config  description  HEAD  hooks  info  objects  refs

Enter fullscreen mode Exit fullscreen mode

This will create a .git directory where Git stores and manipulators is located.
These are default files created.

  • description file is used only by the GitWeb program.
  • config file contains your project-specific configuration options.
  • info directory keeps a global exclude file for ignored patterns that you don’t want to track in a .gitignore file.
  • hooks directory contains your client- or server-side hook script.

Imported entries

  • objects rectory stores all the content for your database.
  • HEAD file points to the branch you currently have checked out
  • refs directory stores pointers into commit objects in that data (branches, tags, remotes, and more).
  • index file is where Git stores your staging area information

Up Next

In the next blog, we will be learning about each part of the .git directory one by one.


FreeDevTools

I’ve been building for FreeDevTools.

A collection of UI/UX-focused tools crafted to simplify workflows, save time, and reduce friction when searching for tools and materials.

Any feedback or contributions are welcome!

It’s online, open-source, and ready for anyone to use.

👉 Check it out: FreeDevTools

⭐ Star it on GitHub: freedevtools

Source

10.1 Git Internals - Plumbing and Porcelain

Top comments (0)