mygit-lite — a simplified Git clone written in JavaScript.
This project implements the core internals of Git (blobs, trees, commits, refs) in pure Node.js as an educational tool.
- Init: Create repositories (
.mygitfolder structure) - Add: Hash files (SHA-1) to blob storage
- Commit: Create snapshots with author/message
- Log: View linear commit history
- Checkout: Switch commits/branches (restore working tree)
- Branch: Create, list, and delete branches
- Diff: View file modifications (index vs working tree)
npm install -g mygit-lite# Initialize
mygit init
# Add files
echo "hello" > README.md
mygit add README.md
# Commit
mygit commit -m "Initial commit"
# View History
mygit logSee docs/ARCHITECTURE.md for details on the internal data model.
mygit-lite/
├── bin/ # CLI entry point
├── lib/ # Core logic (Repo, Storage, Indexer)
├── commands/ # Command implementations
├── tests/ # Integration and Unit tests
└── docs/ # Architecture documentation
Run tests:
npm testRun local instance:
node bin/mygit.js status- Merge support
- Remote remotes (push/pull)
- Packfiles
- ".mygitignore" support
MIT