Lil’git - Making Git from scratch in C++
Abstract
Abstract
Mentors:
Abhimanyu Kapoor
Siddhanth Saha
Mentees:
Aditya R Durgad
Omkar C Ksheerasagar
Pritam Mondal
Pocharam Karthik
Alok kumar
Jayani Joshi
Google Meet Link: https://meet.google.com/yoz-ofki-xff
Aim
The aim of this project is to design and implement a lightweight Git-like version control system in C++ from scratch. The goal is to understand how Git internally stores files, tracks changes, and restores previous versions using hashing and filesystem operations.
Introduction
Lil’Git is a simplified implementation of Git built entirely in C++. The project focuses on recreating the core ideas behind Git rather than implementing every feature of the original software.
Modern version control systems like Git are widely used in software development for tracking changes and managing source code. However, many users interact with Git only through commands without understanding how it works internally. Lil’Git was developed to explore Git’s internal architecture through a hands-on implementation.
The project implements concepts such as:
- Blob objects
- Tree objects
- Commit objects
- Hash-based object storage
- Repository initialization
- Commit history traversal
- Checkout functionality
The implementation uses filesystem operations and hashing techniques to store and retrieve repository data similarly to Git.
Literature Survey and Technologies Used
Concepts Studied:
-
Git Internals
- Distributed Version Control Systems
- Content Addressable Storage
- SHA Hashing
- Filesystem Operations
- Tree Data Structures
- Command Line Interface Design
- Git Concepts Implemented:
- Blob Objects
- Tree Objects
- Commit Objects
- Repository Initialization
- Commit Logging
- Checkout Mechanism
Tools Used: C++, STL (Standard Template Library), std::filesystem, OpenSSL Hashing Library, CLI11, CMake, Linux Shell, Git
Methodology
1. Repository Initialization (init):
The init command creates the internal directory structure required for the repository. It creates folders for storing objects, commits, and repository metadata.

2. Blob Objects (hash-object):
Blob objects are used to store file contents.
When a file is added:
- The contents are read
- A SHA hash is generated
- The file is stored using the hash value as its identifier
This introduces the concept of content-addressable storage used in Git.
3. Tree Objects (write-tree & read-tree):
Tree objects represent the directory structure of the repository.
The write-tree functionality traverses files and folders recursively and stores references to blob objects and subdirectories. This allows the repository structure to be recreated later using read-tree.
4. Commit Objects (commit):
Commit objects store snapshots of the repository.
Each commit contains:
- Tree hash
- Parent commit reference
- Commit message
The commit object helps maintain repository history and allows previous versions to be restored.



5. Commit History (log):
The log command traverses commit objects and displays commit history along with commit hashes and messages.
This allows users to track changes made to the repository over time.

6. Checkout (checkout)
The checkout functionality restores the repository to a previous commit state.
The target commit is read, corresponding tree objects are reconstructed, and files are restored in the working directory.


Results
The implemented features successfully replicated the basic working of Git internals.
The project successfully demonstrated:
- Repository initialization
- Object hashing and storage
- Tree creation
- Commit creation
- Commit history traversal
- Checkout to previous commits
The repository was able to store file snapshots and restore previous versions correctly using hashed objects and commit references.
Conclusions and Future Scope
Lil’Git successfully demonstrates the core concepts behind Git and distributed version control systems. Through the implementation of blobs, trees, commits, and checkout functionality, the project provides a practical understanding of how Git internally manages repository data.
Future Scope:
The following features can be added in the future:
- Branching support
- Merge functionality
- Staging area
- Remote repository support
- Diff utilities
These additions would make Lil’Git more feature-complete while continuing to serve as an educational implementation of Git.
References
- Pro Git Book
- Git Internals Documentation
- Git SCM Documentation
- CLI11 Documentation
- C++ Reference Documentation
https://git-scm.com/book/en/v2
https://git-scm.com/docs
https://en.cppreference.com/w/
https://cliutils.github.io/CLI11/book/
Report Information
Team Members
Team Members
Report Details
Created: May 17, 2026, 7:46 p.m.
Approved by: None
Approval date: None
Report Details
Created: May 17, 2026, 7:46 p.m.
Approved by: None
Approval date: None