Skip to content

HalilFocic/gitgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitgo

A Git implementation in Go for learning purposes, focused on understanding core Git concepts by building them from scratch.

Implemented Features

Repository Management

  • Initialize new repository (.gitgo directory structure)
  • Repository validation and path handling
  • Basic directory structure (objects, refs, etc.)

Content Storage (Blobs)

  • Content-addressable storage system
  • SHA-1 based content hashing
  • Zlib compression
  • Object storage in .gitgo/objects

Staging Area (Index)

  • File staging and unstaging
  • Metadata tracking (paths, modes, timestamps)
  • Binary index file format
  • Staged file management

Basic Operations

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

Building and Running

# Build
go build -o gitgo cmd/gitgo/main.go

# Run
./gitgo init
./gitgo add <file>

Implementation Details

Blob Storage

  • Files are stored as content-addressed blobs
  • SHA-1 hash of content determines storage location
  • Content is compressed using zlib

Staging Area

  • Tracks files for commit
  • Stores metadata in binary index format
  • Handles file additions and removals

Learning Purpose

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

Key takeaways

  • 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

Notes

  • This is a learning implementation
  • Not intended for production use
  • Implements subset of Git functionality

About

My own minimal version of Git written in Go

Resources

Stars

Watchers

Forks

Languages