Team Blaze, PBL in Data Structures (C++)

Version control, engineered from first principles.

MiniGit is a local, zero-dependency VCS in C++. Every command runs on a data structure you can inspect.

PowerShellexample session
$ minigit init
Initialized empty MiniGit repository in C:\calc\.minigit
$ minigit ignore *.log
Ignored '*.log' (line 1)
$ minigit add .
staged 4 file(s), 0 already staged, skipped 1 ignored
$ minigit commit -m "first working calculator"
[main 3f9c2ab] first working calculator
4 file(s) committed
$ minigit log
commit 3f9c2ab
date    2026-10-09 18:42:07

    first working calculator
    (4 file(s))

Four folders called final, or one history.

Students keep copies like final_v2 and REAL_FINAL because real version control feels heavy. MiniGit keeps the core idea and nothing else.

Copy-paste backups

No record of what changed, no safe way back, and every copy costs disk space.

  • assignment_final/
  • assignment_final_v2/
  • assignment_REAL_FINAL/
  • assignment_LATEST_DO_NOT_DELETE/

One .minigit/ folder

Stage what matters, ignore what doesn't, commit with a message, and step back with undo.

$ minigit init
$ minigit ignore build/
$ minigit add main.cpp
$ minigit commit -m "core logic added"
$ minigit undo

Four data structures, each with one job.

Every command maps to a structure from the course. The diagrams show what each one holds.

O(L) per path

Two tries for .minigitignore

Files and folders go into a forward trie. Extension rules such as *.log are stored reversed, so a suffix match becomes a prefix match. Each check costs the length of the path, however many rules exist.

path trie        b-u-i-l-d-/            build/      line 2
                 s-e-c-r-e-t-.-e-n-v    secret.env  line 3
extension trie   g-o-l-.                *.log       line 1

query  logs/app.log  reversed  gol.ppa/sgol  matches line 1
Sparsh Jain: ignore engine, add, remove
O(log n) lookup

An ordered set for the index

Staged paths live in a std::set (a red-black tree): no duplicates, and always sorted, so .minigit/index keeps a stable order.

index = { README.md,
          main.cpp,
          src/lexer.cpp }
Sparsh Jain: staging index
O(1) at both ends

Two deques for undo and redo

A commit pushes the previous state onto the undo deque, and undo moves it across to redo. Past 20 entries, pop_front() drops the oldest.

undo  [ A | B | C ]  push_back
redo  [ ]            cleared by a new commit
Krish Bajaj: commit, undo, redo
O(n) walk, either way

A doubly linked list for log

log follows parent links from HEAD and links every commit both ways, so newest-first and --reverse are one walk from either end.

first <-> second <-> third
                          HEAD
Snehil Joshi: log, log --reverse

One static binary, one command table

Built with -static, so minigit.exe needs nothing beyond Windows itself. Every command is a row in one table that also generates its help and usage.

Abhinesh Gangwar: init, CLI, install, cross-module integration
See the architecture

Four layers, one direction.

A command enters at the top, the dispatcher calls one module, and each module works through one data structure that loads and saves its own file. Modules return a result struct and never print; only the CLI writes output. Pick a command to trace its path.

Trace a command
MiniGit architecture Four layers: CLI, modules, data structures and storage. Each command module uses one data structure, and each data structure loads and saves its own file in .minigit/. Dashed boxes are planned: checkout and rollback in Phase 3, and branches as a future idea.
  • calls
  • reads or writes a file
  • lookup
  • planned

Overview

Every module and file at once

Choose a command above, or click a box in the diagram. Its path through the four layers lights up, and the steps explain what happens at each box.

    Run MiniGit in your browser.

    The sandbox follows the real CLI: same commands, same messages, same data structures. It works on a small sample project and nothing leaves your browser.

    Play a workflow:
    ~/calc
    Sample project: main.cpp, calc.h, README.md, src/lexer.cpp, src/parser.cpp, logs/debug.log, build/main.o. Type help, or start with minigit init.

    Every command.

    Eleven commands, grouped by what they work on. Run any of them in the sandbox above.

    Repository

    Start tracking a folder.

    • minigit init

      Creates .minigit/ (objects, refs/heads, HEAD, index) and .minigitignore. Safe to re-run.

    Staging

    Choose what the next commit contains.

    • minigit add <file|dir>

      Stages a file, or every non-ignored file in a folder.

    • minigit add .

      Stages every non-ignored file in the repository.

    • minigit add -v <file>

      Shows whether a file is staged, ignored or missing.

    • minigit remove <file|dir|.>

      Unstages files; your files on disk are never touched. Alias: rm.

    Help and install

    Find your way around, and put MiniGit on your PATH.

    • minigit help [<command>]

      Lists every command, or the usage of one. minigit <command> --help works too.

    • minigit install

      Copies MiniGit into a folder on your PATH. It also does this on first run.

    • minigit uninstall

      Removes the installed copy.

    Ignore rules

    Keep build output and secrets out of history.

    • minigit ignore

      Lists the rules in .minigitignore with line numbers.

    • minigit ignore <pattern>

      Adds a file, folder (build/) or extension (*.log) rule.

    • minigit ignore -r <pattern>

      Removes a rule; later line numbers shift up.

    • minigit ignore -v <path>

      Shows whether a path is ignored, and by which line.

    History

    Record, step back and read your commits.

    • minigit commit "<message>"

      Records the staged files and clears the index. -m "<message>" also works.

    • minigit undo

      Moves HEAD back one commit and restores its staged files. Same as commit undo.

    • minigit redo

      Re-applies the last undone commit. Same as commit redo.

    • minigit log [--reverse]

      Shows history newest first, or oldest first with --reverse.

    Wrong or extra arguments print that command's usage and exit with 1. A typo such as minigit comit suggests the closest command.

    Get MiniGit.

    MiniGit for Windows

    One statically linked executable. Run it once and it copies itself onto your PATH, so minigit works in any terminal.

    File
    minigit.exe
    Size
    3.3 MB
    Platform
    Windows 10 and 11
    Runtime dependencies
    None beyond Windows
    Download for Windows

    Three phases, two done.

    The plan from the Phase 1 design report, and where each part stands after the Phase 2 review.

    1. Phase 1, delivered

      Planning and design

      Scope, command set, .minigit/ layout, class responsibilities and the choice of data structures.

    2. Phase 2, delivered

      Repository and commit module

      init, add, ignore, commit and log, plus undo and redo on two deques and a table-driven CLI.

    In scope

    • One user, one local repository
    • Text files such as .cpp, .h, .md
    • Linear history on a single branch, main
    • File, folder and extension ignore rules

    Out of scope

    • Remotes: push, pull and clone
    • Branches and merging
    • Diffs and delta compression
    • Multiple users or authentication

    Team Blaze.

    DSCPP-III-2026-T296, CSE (AI&ML), Graphic Era University. Systems architecture and cross-module supervision by Abhinesh Gangwar.

    Abhinesh Gangwar

    Team lead and systems architect

    initignorehelpinstall

    CLI, command table and repository setup

    Implements minigit init and the .minigit/ structure with HEAD and index; the ignore command interface and input validation; the dispatcher that connects every command to its module. Supervised and reviewed the Trie matching, deque history and linked-list traversal.

    Cross-module supervision, CLI integration, error messages and final module integration.

    Sparsh Jain

    Trie and staging

    addremove

    Dual trie and the staging index

    Implements the Trie with insert(), search(), remove() and path and extension matching; minigit add <file> and add .; skips ignored files and prevents duplicate staging.

    Staging and index handling, tests for add and ignore.

    Krish Bajaj

    Commits and history

    commitundoredo

    Deque: undo and redo

    Implements minigit commit: commit IDs, metadata and snapshots; a deque of repository states for undo and redo with a history limit.

    Commit tests; connects commit state with storage.

    Snehil Joshi

    History navigation

    loglog --reverse

    Doubly linked list: commit log

    Implements the doubly linked list with insert, find, next and prev; minigit log with commit ID, message and timestamp, forward and backward.

    History loading, log tests and persistence integration.

    Reports and slides.

    The report and presentation for each phase, served from the Reports/ folder.

    Open Save PDF

    MiniGit Phase 2 progress report

    What was built: the four modules, the updated architecture, who did what, roadblocks and the remaining work.