Skip to content

MiniGit is a lightweight, educational version control system built entirely in Node.js.

Notifications You must be signed in to change notification settings

Tahsin005/minigit-vcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniGit — A Minimal Git-Like Version Control System (in JavaScript)

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.

Features

  • 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)

Commands

Initialize a repository

./minigit.mjs init

Creates a .minigit folder containing:

.minigit/
├── HEAD
├── index
└── objects/

Add a file to staging

./minigit.mjs add <filename>

Example:

./minigit.mjs add file.txt

This command:

  • Reads the file
  • Hashes its contents (SHA-1)
  • Stores it under .minigit/objects
  • Updates the staging area (index)

Commit changes

./minigit.mjs commit "<message>"

Example:

./minigit.mjs commit "Initial commit"

Creates a commit object containing:

  • Timestamp
  • Commit message
  • Files from the staging area
  • Parent commit reference (if any)

View commit history

./minigit.mjs log

Displays all commits in reverse chronological order:

-------------------------------------
Commit: 1a2b3c4d...
Date: 2025-11-02T14:05:10Z

Initial commit

Show commit diff

./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!

Displays:

  • Files modified in that commit
  • Differences from the parent commit
  • Color-coded diff using chalk

Example Images

About

MiniGit is a lightweight, educational version control system built entirely in Node.js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published