Skip to content

jelly-afk/git-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git-Go

A simple Git implementation written in Go. This project implements core Git functionality including repository initialization, object storage, tree creation, and commit management.

Features

  • init: Initialize a new Git repository
  • cat-file: Display the contents of a Git object
  • hash-object: Compute object ID and optionally creates a blob from a file
  • ls-tree: List the contents of a tree object
  • write-tree: Create a tree object from the current index
  • commit-tree: Create a new commit object
  • clone: Clone a remote repository

Prerequisites

  • Go 1.22 or later
  • Bash shell (for running the provided script)

Installation

  1. Clone the repository:
git clone <repository-url>
cd git-go
  1. Make the run script executable:
chmod +x run.sh

Usage

The project provides a wrapper script run.sh that builds and executes the Git implementation. All commands should be run through this script:

./run.sh <command> [arguments...]

Available Commands

Initialize a Repository

./run.sh init

Create and Store a Blob

./run.sh hash-object -w <file>

Display Object Contents

./run.sh cat-file -p <sha>

List Tree Contents

./run.sh ls-tree --name-only <sha>

Create a Tree Object

./run.sh write-tree

Create a Commit

./run.sh commit-tree <tree-sha> -p <parent-sha> -m <message>

Clone a Repository

./run.sh clone <repository-url>

About

git implementation from scratch in go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published