Skip to content

aneeshsunganahalli/GoGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoGit

A lightweight version control system inspired by Git, written in Go.

GoGit Go License


Overview

GoGit is a minimal, from-scratch implementation of core Git concepts — commits, branches, staging, and history — built entirely in Go. It's designed to be easy to understand, extend, and use as a learning reference for version control internals.


Installation

Prerequisites: Go 1.21 or later

# 1. Clone the repository
git clone https://github.com/aneeshsunganahalli/GoGit.git

# 2. Navigate into the project
cd GoGit

# 3. Build the binary
go build -o gogit main.go

Usage

./gogit <command> [arguments]

Commands

Command Description
init Initialize a new repository in the current directory
add <path> Stage a file or directory for the next commit
commit <message> Commit all staged changes with a message
log Show commit history up to the current HEAD
branch <name> Create a new branch at the current commit
status Display the current branch and staged changes
checkout <branch> Switch to a branch and update the working directory

init

Initializes a new GoGit repository in the current directory.

./gogit init

add

Stages a file or directory for the next commit.

./gogit add <file-or-directory>

commit

Records all staged changes as a new commit with the provided message.

./gogit commit "Your commit message"

log

Prints the full commit history from HEAD backwards.

./gogit log

branch

Creates a new branch pointing to the current commit.

./gogit branch <branch-name>

status

Shows the active branch and a summary of staged changes.

./gogit status

checkout

Switches to the specified branch and updates the working directory to match.

./gogit checkout <branch-name>

License

Released under the MIT License. Free to use, modify, and distribute.

About

My own implementation of Git in Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages