MiniGit is a lightweight, educational version control system built entirely in Node.js. It mimics core Git functionalities such as init, add, commit, log, and diff — all implemented from scratch to explore how Git works under the hood.
- Initialize a new .minigit repository
- Add files to the staging area
- Commit changes with messages
- View commit history
- Compare commits and view diffs (color-coded output)
./minigit.mjs init
Creates a .minigit folder containing:
.minigit/
├── HEAD
├── index
└── objects/
./minigit.mjs add <filename>
Example:
./minigit.mjs add file.txt
- Reads the file
- Hashes its contents (SHA-1)
- Stores it under .minigit/objects
- Updates the staging area (index)
./minigit.mjs commit "<message>"
Example:
./minigit.mjs commit "Initial commit"
- Timestamp
- Commit message
- Files from the staging area
- Parent commit reference (if any)
./minigit.mjs log
-------------------------------------
Commit: 1a2b3c4d...
Date: 2025-11-02T14:05:10Z
Initial commit
./minigit.jsx show <commitHash>
Example:
./minigit.jsx show cb5b6c35fd31ad8862d1740e268a122d3db08f09
Already initialized the .minigit folder
Changes in the last commit are:
File: file.txt
This is some text content from a file. This will be added in the minigit vcs. Adding this text.
She sells seashells by the seashore.
This is the previous line. Hurray!
This is another line!
Diff:
This is some text content from a file. This will be added in the minigit vcs. Adding this text.
She sells seashells by the seashore.
-- This is a new line!
++ This is the previous line. Hurray!
This is another line!
- Files modified in that commit
- Differences from the parent commit
- Color-coded diff using chalk




