A Git implementation in Go for learning purposes, focused on understanding core Git concepts by building them from scratch.
- Initialize new repository (
.gitgo
directory structure) - Repository validation and path handling
- Basic directory structure (objects, refs, etc.)
- Content-addressable storage system
- SHA-1 based content hashing
- Zlib compression
- Object storage in
.gitgo/objects
- File staging and unstaging
- Metadata tracking (paths, modes, timestamps)
- Binary index file format
- Staged file management
gitgo init # Initialize new repository
gitgo add # Add file to staging area
gitgo remove # Remove file from staging
gitgo checkout # switch between branches
gitgo branch # list branches and show current branch
gitgo branch -c # create branch
gitgo branch -d # delete branch
gitgo log # show commit history
# Build
go build -o gitgo cmd/gitgo/main.go
# Run
./gitgo init
./gitgo add <file>
- Files are stored as content-addressed blobs
- SHA-1 hash of content determines storage location
- Content is compressed using zlib
- Tracks files for commit
- Stores metadata in binary index format
- Handles file additions and removals
This project was built to understand Git's internal working by implementing core concepts from scratch. It focuses on:
- Content-addressable storage
- Binary file formats
- Path handling
- Object storage and compression
- Understanding Git and it's internals(blobs,trees,commits)
- Binary File formats ( serialization/deserialization, byte alignment and padding)
- File system operations (path handling, file permissions,directory traversal)
- Data structures (Trees)
- Improved Golang knowledge
- This is a learning implementation
- Not intended for production use
- Implements subset of Git functionality