sidgit is a distributed version control system engineered from first principles in Go, implementing Git's cryptographic object model and directed acyclic graph (DAG) commit structure. The system features a content-addressable storage engine with SHA-1 cryptographic hashing, zlib compression, and atomic operations, enhanced with modern concurrent processing, topological graph algorithms, and advanced terminal visualization capabilities.
Includes comprehensive web-based repository visualizer for interactive commit graph exploration and Git internals analysis.
Full-featured command-line version control system with Git-compatible object storage and advanced visualization capabilities.
Next.js-based web application providing interactive commit graph visualization, comprehensive object inspection, and Git internals analysis interface.
- Repository Management:
init- Initialize new repositories with standard Git directory structure - Staging & Commits:
add(concurrent),commit- Full staging area with parallel file processing - History & Inspection:
logwith graph visualization,statuswith color-coded output,diffwith unified format - Branching & Merging:
branch,checkout,merge(fast-forward),branch list - Object Inspection:
cat-file,hash-object,write-tree- Low-level object store access
- ASCII Commit Graphs: Topological sorting with multi-branch visualization (
log --graph) - Concurrent Operations: Parallel file processing in
addcommand using goroutines - Enhanced UI: Color-coded status output, formatted object display, branch diagrams
- Git Compatibility: Standard object format (SHA-1, zlib compression), refs structure
- Web Visualization: Interactive SVG commit graphs with comprehensive object inspection
- Interactive Commit Graph: SVG-based topological visualization with real-time selection
- Multi-tab Inspector: Details, Files, Changes, Raw, and Explorer views
- Object Analysis: SHA-1 lookup, cryptographic analysis, storage format inspection
- Diff Visualization: Side-by-side content comparison with change statistics
- Repository Upload: Drag-and-drop interface with automatic
.sidgitdetection
sidgit init [path] # Initialize repository
sidgit status # Show working tree status with colors
sidgit add <files...> # Stage files (concurrent processing)
sidgit commit -m "message" # Create commitsidgit log # Linear commit history
sidgit log --graph # ASCII commit graph with branches
sidgit log --oneline # Compact one-line format
sidgit log --graph --oneline # Combined graph and compact viewsidgit branch <name> # Create new branch
sidgit branch list # List all branches with latest commits
sidgit checkout <branch> # Switch branches
sidgit merge <branch> # Fast-forward mergesidgit diff # Working directory vs index
sidgit diff --staged # Index vs HEAD
sidgit cat-file <hash> # Inspect objects (formatted output)
sidgit hash-object <file> # Generate object hash
sidgit write-tree # Create tree from indexThe system implements a sophisticated three-layer architecture based on Git's proven distributed version control model:
| Component | Description |
|---|---|
| Cryptographic Addressing | Objects identified by SHA-1 hash (160-bit) of their content, ensuring immutable references and collision-resistant addressing |
| Object Types | Four fundamental types following Git's object model: • blob: Raw file content with size header• tree: Directory snapshots with mode, type, hash, and name entries• commit: History nodes containing tree pointer, parent references, author/committer metadata, and message• tag: Annotated references (future implementation) |
| Storage Format | Objects stored in .sidgit/objects/XX/YYYY... hierarchy with zlib (RFC 1950) compression |
| Atomic Operations | Write operations use temporary files with atomic rename for consistency |
| Deduplication | Identical content automatically deduplicated through content addressing |
| Component | Description |
|---|---|
| Commit Graph | History represented as DAG where commits are nodes and parent relationships are directed edges |
| Topological Ordering | Implements Kahn's algorithm for commit traversal ensuring proper ancestry relationships |
| Reference Management | • HEAD: Symbolic reference to current branch (ref: refs/heads/<branch>)• Branches: Direct references stored in refs/heads/ pointing to commit objects• Detached HEAD: Direct object reference for specific commit checkout |
| Graph Algorithms | Custom implementation for ancestry checking, merge-base calculation, and reachability analysis |
| Multi-parent Support | Architecture supports merge commits (multiple parents) for future three-way merge implementation |
| Component | Description |
|---|---|
| Three-Tree Architecture | Working Directory ↔ Index ↔ Repository with independent state tracking |
| Index Structure | Binary format storing: • File metadata (mode, size, timestamps) • SHA-1 hashes of staged content • Path information with lexicographic ordering |
| Concurrent Processing | Parallel file hashing and object creation using worker pool pattern with goroutines |
| State Transitions | Explicit staging allows granular commit preparation and conflict resolution |
| Performance Optimizations | • Stat-based change detection • Incremental index updates • Memory-mapped file operations for large repositories |
cmd/sidgit-go/ # CLI interface (Cobra framework)
├── main.go # Application entry point
└── cmd/ # Command definitions with flags
internal/
├── cli/ # Command handlers and business logic
├── git/ # Core Git operations and data structures
└── ui/ # Enhanced output formatting and visualization
visualizer-ui/ # Web-based repository visualizer
├── app/ # Next.js App Router pages and API routes
├── components/ # React components for visualization
├── types/ # TypeScript type definitions
└── lib/ # Utility functions and helpers
- Concurrent Processing: Goroutine-based parallel file operations
- Graph Algorithms: Topological sorting for commit history visualization
- Object Parsing: Full support for Git object formats
- UI Enhancements: Color coding, ASCII art, formatted output
- Web Interface: Interactive SVG rendering with real-time object inspection
# Add custom tap
brew tap sidxh/xyz
# Install sidgit CLI
brew install sidgit
# Verify installation
sidgit --helpgit clone https://github.com/sidxh/sidgit-go
cd sidgit-go
go build -o sidgit cmd/sidgit-go/main.go
# Optional: Install globally
sudo mv sidgit /usr/local/bin/cd visualizer-ui
npm install
# or
pnpm install
# Start development server
npm run dev
# or
pnpm dev
# Access at http://localhost:3000cd visualizer-ui
npm run build
npm start
# or
pnpm build
pnpm start# Initialize and create first commit
mkdir project && cd project
sidgit init
echo "Hello World" > README.txt
sidgit add README.txt
sidgit commit -m "Initial commit"
# Create and work with branches
sidgit branch feature
sidgit checkout feature
echo "Feature code" > feature.txt
sidgit add feature.txt
sidgit commit -m "Add feature"
# Visualize history
sidgit log --graph --oneline
sidgit branch list
# Merge and inspect
sidgit checkout main
sidgit merge feature
sidgit status- Create Repository: Use CLI to initialize and populate repository
- Access Visualizer: Navigate to web interface at
http://localhost:3000 - Upload Repository: Drag-and-drop project directory containing
.sidgitfolder - Explore History: Click commit nodes to inspect details, files, and changes
- Analyze Objects: Use Explorer tab for direct SHA-1 hash inspection
# Create repository with CLI
sidgit init my-project
cd my-project
echo "Initial content" > file1.txt
sidgit add file1.txt
sidgit commit -m "Initial commit"
# Create branch and additional commits
sidgit branch feature
sidgit checkout feature
echo "Feature content" > file2.txt
sidgit add file2.txt
sidgit commit -m "Add feature"
# Visualize in web interface
# Upload my-project directory to visualizer
# Explore interactive commit graph and object detailsMIT License - see LICENSE file for details.