DEV Community

Cover image for I Built My Own Git (Without Git): SnapTrack, a VS Code Extension
SWEETAN MARIYAPPAN
SWEETAN MARIYAPPAN

Posted on Edited on AI-assisted

I Built My Own Git (Without Git): SnapTrack, a VS Code Extension

You changed twenty files, your site broke, and you never ran git init. Now what?

That happened to me one too many times, so I built SnapTrack: a free VS Code extension that gives you Git-style change tracking for any folder, with no Git, no terminal and no setup.

πŸ‘‰ Install: SnapTrack on the VS Code Marketplace (or search "SnapTrack" in the Extensions panel)

Why not just use Git?

Git is amazing. But for a quick prototype, a client's HTML folder or a student project, init β†’ add β†’ commit β†’ branches β†’ remotes feels heavy. And Ctrl+Z dies the moment you close the file.

I wanted four things:

  1. See what changed
  2. Review the diff
  3. Confirm it (like a commit)
  4. Or throw it away

How it works for you

Open any folder β†’ Source Control β†’ click + Start Tracking. SnapTrack saves a first snapshot (big files like videos are skipped automatically).

From then on, every edit shows up in Source Control with M (modified), A (added) and D (deleted), the same letters appear in the Explorer, and the editor gutter marks the changed lines. Click a file and you get a real side-by-side diff:

SnapTrack side-by-side diff in VS Code: Changes list with M, A and D, last commit on the left, current file on the right

  • Commit: type a message, press Ctrl+Enter. SnapTrack shows exactly what will be saved and asks you to confirm.
  • Discard: click the discard arrow on a file. It asks first, and saves a safety checkpoint before throwing anything away, so even a discard can be undone.

New in 1.1

SnapTrack History sidebar listing commits and a safety checkpoint, expanded to show the changed files

  • History sidebar: every commit and checkpoint; expand one to see its files, click for the diff, right-click to compare any two commits.
  • File History: every saved version of the file you have open.
  • Auto checkpoints: every 10 minutes (if something changed) a silent snapshot is saved. It never touches your Changes list. A small time machine.
  • Restore Project: roll the whole folder back to any commit (your current work is checkpointed first).
  • Undo Last Commit: files stay as they are, the changes and message come back.
  • Export: changes as a .patch, any commit as a .zip. Clean Up Storage prunes old checkpoints.

How it works inside

It's built like Git, just smaller:

  • Every file is hashed with SHA-1 and compressed with zlib; identical files are stored once (content-addressed objects in .snaptrack/objects/ab/cdef…).
  • A commit is just a JSON list of file paths and hashes (commits.json), plus an index cache (size + mtime β†’ hash) so unchanged files aren't re-read.
  • Everything lives in one hidden .snaptrack folder in your project. Delete it and tracking stops. Nothing is uploaded anywhere.
  • Skip folders with a .snaptrackignore file (same style as .gitignore).
  • There's also a small CLI: snaptrack status | diff | commit -m "..." | log | restore.

The diff view, gutter markers and M/A/D badges come from VS Code's own Source Control API, so it feels native.

Try it

Would you use something like this instead of Git for small projects? I'd love feedback, bug reports and feature ideas in the comments.

🌐 seeb4coding.in

Top comments (3)

Collapse
 
userxnom profile image
Abdullah Naseer •

The safety checkpoint before a discard is the detail that sold me on this. Most lightweight trackers make discard a one-way door, and that is exactly why people do not trust them with real work. Pairing that with content-addressed storage and a .snaptrackignore file makes it feel like a real tool, not a demo.

The auto-checkpoint every 10 minutes is interesting too β€” it quietly solves the "I forgot to commit before trying something risky" problem. How do you keep the .snaptrack folder from growing out of control on a long-lived project, and which feature did people ask for first, the History sidebar or the auto checkpoints?

Collapse
 
sweetan008 profile image
SWEETAN MARIYAPPAN •

Thanks Abdullah, glad that detail landed. Making discard a one-way door is exactly what I wanted to avoid.

On storage growth, a few things keep .snaptrack small:

  • Content-addressed objects: identical files are stored once, so a checkpoint only adds the files that actually changed, zlib-compressed.
  • Auto checkpoints only fire if something changed in the last 10 minutes, so an idle project adds nothing.
  • Big files (videos, etc.) are skipped automatically, and you can exclude node_modules, build output and so on with .snaptrackignore.
  • Clean Up Storage prunes old checkpoints and deletes objects that nothing points to anymore. Your commits are never touched.

On which came first: the History sidebar. Once people could commit, the next question was "where can I see what I committed?" Auto checkpoints came out of my own "I forgot to commit before trying something risky" moments, which you described perfectly.

SnapTrack is now open source too: github.com/seeb4coding/snaptrack
Issues and PRs are welcome. If you have ideas for smarter retention, like keeping hourly checkpoints for a day and daily ones for a week, I'd love to hear them there.

Collapse
 
userxnom profile image
Abdullah Naseer •

This is a really thoughtful storage design β€” content-addressed objects plus the 10-minute change gate means an idle project costs nothing, and never touching commits in Clean Up Storage is the right trust call. The hourly-for-a-day, daily-for-a-week idea feels like the natural next tier: keep the newest checkpoint in each window and prune the rest, so a week-old project still has a daily trail without the folder ballooning. One question: would you let users pin a checkpoint so pruning never touches it, or keep retention purely time-based so there is nothing to manage?