Skip to content

muaviz/dd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dd

A Git-inspired version control system written in C++ for Linux.

dd was built from scratch to understand how modern version control systems work internally. Instead of relying on existing libraries, the project implements core concepts such as content-addressable storage, immutable objects, commit history, branching, checkout, and repository reconstruction.

Features

  • Initialize and manage repositories.
  • Store data using content-addressable object storage.
  • Support blob, tree, and commit objects.
  • Stage and track file changes through an index.
  • Create commits and traverse repository history.
  • Create, list, and switch between branches.
  • Checkout commits or branches and reconstruct the working tree.

Example Usage

image

Documentation

  • Architecture — Overview of the repository design, object model, and component relationships.
  • Storage Format — Details of blob, tree, commit, and index storage formats.

Building

Requirements

  • Linux
  • CMake
  • C++17 compatible compiler

Build

git clone <repository>
cd dd

mkdir build
cd build

cmake ..
cmake --build .

Usage

Initialize Repository

dd init

Stage Files

dd add file.txt

Create Commit

dd commit -m "initial commit"

View History

dd log

Create Branch

dd branch dev

List Branches

dd branch

Switch Branch

dd checkout dev

Checkout Commit

dd checkout <commit_hash>

Repository Layout

.dd/
├── objects/
│
├── refs/
│   └── heads/
│
├── HEAD
├── index
└── config

Components

Component Purpose
objects/ Stores all immutable objects
refs/heads/ Branch references
HEAD Current checked-out branch or commit
index Staging area
config Repository configuration

Key Learnings

During development, the project explored:

  • Content-addressable storage
  • Hash-based object databases
  • Snapshot-based version control
  • Commit graph traversal
  • Recursive tree structures
  • Filesystem manipulation
  • Layered software architecture
  • CLI application design
  • Persistent storage systems

Future Work

Potential future extensions include:

  • Diff engine
  • Three-way merge
  • Merge commits
  • Tags
  • Object compression
  • Packfiles
  • Remote repositories
  • Push / Pull support
  • Clone support
  • Conflict resolution
  • Detached HEAD improvements

Acknowledgements

This project was inspired by the design principles of Git and was developed as an educational exploration of version control internals and systems programming in C++.

About

Basic Version Control System

Resources

Stars

Watchers

Forks

Contributors