Logo

dev-resources.site

for different kinds of informations.

I built Zeet. A Git-like version Control System

Published at
1/13/2025
Categories
showdev
git
discuss
node
Author
smitterhane
Categories
4 categories in total
showdev
open
git
open
discuss
open
node
open
Author
11 person written this
smitterhane
open
I built Zeet. A Git-like version Control System

πŸš€ Source Code

You can find the source code for Zeet on GitHub.

🎬 DEMO

zeet demo in asciicast

Motivation

Some time back, my curiosity about the inner workings of Git led me on an exciting journey. I sifted through various resources(though not Git’s source code) to understand how Git works. Inspired, I wrote an article summarizing my findings. What stook with me from git-scm book:

The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data.

Conceptually, most other systems store information as a list of file-based changes.

Git doesn’t think of or store its data this way. Instead, Git thinks of its data more like a series of snapshots of a miniature filesystem.

That insight stayed with me, but I didn't do much with itβ€”until I stumbled upon a challenge to build a Version Control System (VCS). I embraced it eagerly, seeing it as an opportunity to transform my theoretical knowledge into a tangible project. And so, I worked on Zeetβ€”a lightweight, Git-inspired VCS built with Node.js.

How Zeet Works

Much like Git, Zeet manages repository versions as snapshots. It uses a .zeet directory to store all its data locally, but unlike Git, the snapshots are not compressed.

The process involves three main areas:

  • Working Directory: Where you edit files.
  • Staging Area: Files added here are prepared for commits.
  • Local Database: Stores snapshots of committed changes.

Zeet captures the essence of Git while offering simplicity for educational and hobbyist purposes.

Features of Zeet

πŸ› οΈ What Zeet Can Do

  1. Repository Initialization: Create a Zeet repository with a .zeet subdirectory.
  2. Staging Files: Add files to the staging area before committing.
  3. Committing Changes: Save staged files to the local database with descriptive messages.
  4. Branching: Work on parallel branches and switch between them effortlessly.
  5. Merging: Merge branches intelligently using fast-forward or 3-way merges.
  6. Conflict Detection and Resolution: Detect conflicts during merges, mark them with symbols (<<<<<<<, =======, >>>>>>>), and resolve them manually.
  7. File Ignoring: Specify files to ignore using .zeetignore or .gitignore.
  8. Commit History: View detailed and colorized logs of commit histories.
  9. Diffs: Compare changes between commits, branches, or files.

πŸ›‘ What Zeet Cannot Do (Yet)

  • Show the repository status beyond staged, untracked, or deleted files.
  • Clone remote repositories.
  • Perform rebase merges.

How to use Zeet

Install Zeet globally via npm:

`npm i -g zeet`
Enter fullscreen mode Exit fullscreen mode

Requirements:

  • Node.js v20+
  • A basic understanding of CLI tools

Core Commands

  1. See usage

    zeet --help
    
  2. Initialize Repository

    zeet init
    
  3. Stage Files

    zeet add <file1> <file2> ...
    

    To stage all files:

    zeet add .
    
  4. Commit changes

    zeet commit -m "Your Commit message"
    
  5. View commit history

    zeet log
    
  6. Branch Management:

    1. Create a branch:

      zeet branch <branch-name>
      
    2. Switch branches:

      zeet switch <branch-name>
      
  7. Merge branches

    zeet merge <branch-name>
    

    Merge conflicts will be detected and marked for manual resolution.

  8. View diffs

    zeet diff <commit-hash>
    

    Compares two commits:

    zeet diff <commit-hash1> <commit-hash2>
    

    In place of <commit-hash>, you can alternatively specify branch or path to a file under repository.

Final toughts

Zeet is a hobby project that distills the essence of Git into a minimal yet functional version control system. While it’s not as robust as Git, it showcases the core principles of version control, making it a great tool for learning and experimenting.

Want to contribute? Head over to the Zeet repository on GitHub.

We could make Zeet even better.

showdev Article's
30 articles in total
Favicon
Automate vCluster Management in EKS with Sveltos and Helm
Favicon
Breweries App
Favicon
Build Your Perfect Roadmap with Roadmap Creator - A Simple and Intuitive Tool
Favicon
Building a Developer-Focused Search Engine in Rust: Lessons Learned and Challenges Overcome πŸš€
Favicon
Sample Programs Repo Celebrates 1,000 Code Snippets
Favicon
Bag: A header-only, simplistic, C++20, zipping & unzipping library.
Favicon
[Boost]
Favicon
I built Zeet. A Git-like version Control System
Favicon
AnyAppStart
Favicon
App for sharing time slots for meetings
Favicon
Rust-Powered Password Decrypter: Find the String Behind the Hash! πŸ¦€πŸ”’
Favicon
Turn Your Life into a Real-Life RPG and Level Up Like a Pro
Favicon
Building a webhook tester from scratch
Favicon
Built a todo app
Favicon
366 days of launch weeks
Favicon
How to Enhance Notion Templates with AI for Smarter Workflows
Favicon
Promoting my project https://github.com/oitcode/samarium in this year 2025. Happy new year all.
Favicon
vogen - Value Object Generator in golang
Favicon
Building a No Code AI Platform and the BFS Algorithm
Favicon
Practice SQL using Cricket Dataset (Moneybowl)
Favicon
🎁 The Dev-First OpenGraph (OG) Image Tool You Need (50% Off Lifetime Access!)
Favicon
Config-file-validator v1.8.0 released!
Favicon
Rusty Journal: A Minimal and Efficient CLI Journal & ToDo App
Favicon
Plangs! Your Guide to Programming Languages
Favicon
Introducing an AI Reels Creator with Stock Assets
Favicon
working on my drawing board app. + 1 screenshot. Will share more soon
Favicon
🀯 #NODES24: a practical path to Cloud-Native Knowledge Graph Automation & AI Agents
Favicon
Meet Your New Productivity Partner: NoteBook-App
Favicon
Initial commit
Favicon
Festive New Year Celebration with Fireworks, Confetti, and More! πŸŽ‰

Featured ones: