We use Git every day across the tech industry, but very few engineers actually understand how it works under the hood. So I built my own version of Git from scratch in TypeScript and Node.js: git-ts Instead of wrapping existing libraries, I implemented Git’s core mechanics directly: - Writing and reading objects using the same binary format as native Git - Hashing file contents with SHA-1 and compressing them with zlib - Parsing and updating the staging area (index file) - Managing branches by manipulating raw references - Traversing commit history using graph algorithms (BFS) to support operations like log and fast-forward merge The result: You can create a commit with git-ts, and the native Git CLI will recognize it seamlessly. That constraint (full compatibility with Git’s internal data structures) was the most challenging and rewarding part of the project. This pushed me far outside typical web development: - Working with binary buffers instead of JSON - Understanding Git as a content-addressable filesystem - Implementing low-level file system operations and graph traversal logic One realization that stuck with me: A Git branch is just a text file pointing to a 40-character hash. If you want to take a look (or roast it), here’s the repo: https://lnkd.in/dH9-UEUF #git #typescript #nodejs #software #VersionControl #DevTools
great work moustafa🙏🏾
Well done 👏
Well done👏
Well done Moustafa👍
Good Job ya Darsh
Well done Moustafa! 👏
Nicee!
very impressive work ! i would recommend to read about the command design pattern and apply it as the client is handling too many responsibilities which makes it hard to scale and maintain. Also using a command registry "a map" instead of switching would make the code more modular specially when adding more commands in the future.