A lightweight version control system inspired by Git, written in Go.
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.
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./gogit <command> [arguments]| 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 |
Initializes a new GoGit repository in the current directory.
./gogit initStages a file or directory for the next commit.
./gogit add <file-or-directory>Records all staged changes as a new commit with the provided message.
./gogit commit "Your commit message"Prints the full commit history from HEAD backwards.
./gogit logCreates a new branch pointing to the current commit.
./gogit branch <branch-name>Shows the active branch and a summary of staged changes.
./gogit statusSwitches to the specified branch and updates the working directory to match.
./gogit checkout <branch-name>Released under the MIT License. Free to use, modify, and distribute.