justdoit

module
v0.0.0-...-d716d3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2025 License: Apache-2.0

README ยถ

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 ๐Ÿ› ๏ธ

  1. Clone the repository

    git clone https://github.com/utkarsh5026/justdoit.git
    
  2. Build the project

    cd justdoit
    go build -o justdoit app/main.go
    
  3. 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.

Directories ยถ

Path Synopsis
app
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL