JustDoIt ๐
A lightweight implementation of Git in Golang
What is JustDoIt? ๐ค
JustDoIt is my personal exploration into how Git works under the hood. I've always been fascinated by Git's concepts and internal structure, so I decided to build my own implementation from scratch using Go. This project isn't meant to replace Git (obviously!), but rather to deepen my understanding of version control systems and improve my Go skills along the way.
Project Status ๐๏ธ
This is very much a work in progress! I've implemented several core Git features, but there's still a lot to do. I'm building this in my spare time for fun and learning, so progress might be slow but steady.
Features Implemented So Far โ
- Basic repository initialization - Create new repositories with
justdoit init
- Object model implementation - Blobs, Trees, Commits, and Tags
- Content-addressable storage - Using SHA-1 hashing
- Key-value list message (KVLM) parsing - For handling commit and tag messages
- File system interactions - Reading and writing Git objects
- Repository navigation - Finding Git repositories in parent directories
- Content inspection - View contents of Git objects with
cat-file
- Object hashing - Hash files with
hash-object
- Tree listing - View directory structure with
ls-tree
- Reference management - Create and view refs with
show-ref
- Checkout capability - Extract a commit to the working directory
- Tagging - Create and list tags
- Index handling - View index contents with
ls-files
- Simple .gitignore support - Check if files are ignored with
check-ignore
Architecture Overview ๐๏ธ
I've tried to maintain a clean architecture that somewhat mirrors Git's own design:
- Objects package: The core Git objects (blob, tree, commit, tag)
- Repository package: Repository management and file handling
- Commands package: Implementation of Git-like commands
- Internal package: Internal utilities for index parsing and gitignore handling
- Ordered Dictionary: A custom data structure for maintaining ordered key-value pairs
How To Use ๐ ๏ธ
-
Clone the repository
git clone https://github.com/utkarsh5026/justdoit.git
-
Build the project
cd justdoit
go build -o justdoit app/main.go
-
Run commands
./justdoit init
./justdoit cat-file -t <object-hash>
./justdoit hash-object -w <file-path>
./justdoit ls-tree -r HEAD
./justdoit checkout -c <commit-hash> -p <path>
./justdoit show-ref
./justdoit ls-files
Learning Experience ๐
Building JustDoIt has taught me a ton about:
- Git's object model and content-addressable storage
- How Git manages references and branches
- The structure of the index file
- How to build CLI applications in Go
- Effective error handling in Go
- Managing file system operations
Why "JustDoIt"? ๐ก
The name "JustDoIt" reflects my approach to this project. Instead of just thinking about building a Git implementation, I decided to "just do it" as a practical way to learn. Plus, it's a reminder to myself to keep making progress even if I can't implement everything at once.
What's Next? ๐ฎ
I have several features in mind for future development:
- Implement
commit command
- Add support for branches
- Build a simple
diff implementation
- Add support for remote repositories
- Implement basic network operations
- Add more index manipulation commands
- Improve error handling and user feedback
Acknowledgments ๐
- The Git community for creating such an elegant version control system
- Various online resources about Git internals that helped me understand the concepts
- The Go community for building an awesome programming language
Contribution ๐ค
While this is primarily a personal learning project, I'm open to suggestions and contributions! Feel free to open an issue or submit a PR if you have ideas for improvements.
License ๐
This project is licensed under the MIT License - see the LICENSE file for details.