Skip to content

tejas-mathangi/mini-GIT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniVC — Minimal Version Control System

A version control tool built from scratch in pure Python
CLI + Web UI • SHA-256 content hashing • Zero dependencies


Features

  • Content-addressed storage — Files stored as SHA-256 hashed blobs, trees, and commits
  • Full branching — Create and switch between branches with working directory restoration
  • Myers diff algorithm — Line-by-line diff with custom O(ND) implementation
  • Beautiful Web UI — Dark-themed dashboard at localhost:7000 with:
    • Branch navigator and commit timeline
    • File tree browser
    • Color-coded diff viewer with line numbers
    • Repository status panel
    • Real-time polling (2s) to reflect CLI changes instantly
  • Pure Python stdlib — No external dependencies whatsoever

Quick Start

# Clone the repo
git clone https://github.com/tejas-mathangi/mini-GIT
cd mini-GIT

# Initialize a MiniVC repository
python minivc.py init

# Create and stage files
echo "Hello, MiniVC!" > hello.txt
python minivc.py add hello.txt

# Commit
python minivc.py commit -m "Initial commit"

# View history
python minivc.py log

# Launch the web UI
python minivc.py ui
# → Open http://localhost:7000

Commands

Command Description
minivc init Initialize a new .minivc/ repository
minivc add <file> Stage a file (use . for all files)
minivc commit -m "msg" Commit staged files
minivc log Show commit history
minivc status Show staged, unstaged, and untracked files
minivc branch [name] List branches or create a new one
minivc checkout <branch> Switch to a branch
minivc diff <ref1> <ref2> Show diff between two commits/branches
minivc ui Launch the web dashboard at localhost:7000

Repository Structure

.minivc/
├── HEAD              # Current branch reference
├── index             # JSON staging area
├── objects/          # Content-addressed blob/tree/commit store
│   ├── ab/           # First 2 chars of SHA-256
│   │   └── cdef...   # Remaining chars (zlib compressed)
│   └── ...
└── refs/
    └── heads/
        ├── main
        └── feature-x

Object Model

Type Description
Blob Raw file content, hashed with SHA-256("blob {size}\0{bytes}")
Tree Directory listing: (mode, filename, hash) entries
Commit Snapshot with tree hash, parent, author, timestamp, and message

Web UI

The web UI is served as a single self-contained HTML page — no external files or dependencies.

  • Sidebar: Branch list, commit timeline with interactive selection, status badges
  • Main panel: Commit details, file tree browser, diff viewer, status overview
  • Design: Catppuccin Mocha color scheme, monospace fonts, smooth hover transitions

Demo

Run the included demo script to see MiniVC in action:

chmod +x demo.sh
./demo.sh

This will:

  1. Initialize a repository
  2. Create files and make 3 commits across 2 branches
  3. Launch the web UI

Architecture

minivc.py            # Entry point
minivc/
├── __init__.py      # Package init
├── cli.py           # argparse CLI with subcommands
├── commands.py      # High-level command implementations
├── objects.py       # Content-addressed storage engine
├── index.py         # Staging area management
├── diff.py          # Myers diff algorithm
└── server.py        # HTTP server + embedded Web UI

Requirements

  • Python 3.6+ (stdlib only, no pip install needed)
  • Works on macOS, Linux, and Windows

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors