Categorygithub.com/Kei-K23/git-go
modulepackage
0.0.0-20240926120711-7eb13b212b75
Repository: https://github.com/kei-k23/git-go.git
Documentation: pkg.go.dev

# README

Git-Go

Git-Go is a simplified and lightweight Git implementation written in Go. It replicates key features of Git, such as creating repositories, adding files, committing changes, and working with branches.

Features

  • Initialize a new Git repository (init)
  • Add files to the staging area (add)
  • Commit changes to the repository (commit)
  • Show the list of commits (log)
  • Show the list of staged files (ls-files-stage)
  • List, create and delete branch (branch)

Setup and Installation

  1. Clone the repo and install modules
git clone https://github.com/Kei-K23/git-go.git
cd git-go
go mod tidy
  1. Build the project
go build -o git-go
  1. Test the binary
./git-go --help

Example output will be

git-go is a lightweight version of Git implemented in Go.

Usage:
  git-go [flags]
  git-go [command]

Available Commands:
  add            Add file contents to the index
  branch         List, create, or delete branches
  commit         Record changes to the repository
  completion     Generate the autocompletion script for the specified shell
  help           Help about any command
  init           Initialize a new Git repository
  log            Show commits log
  ls-files-stage Show information about files in staging area

Flags:
  -h, --help   help for git-go

Use "git-go [command] --help" for more information about a command.

Example

  1. Init (Initialize a new Git repository)
./git-go init

Example output will be

Initialized empty .git-go repository.
  1. Add (Add files to the staging area)
./git-go add test.txt

Example output will be (hash value will be different depending on your file content)

Stored object as : .git-go/objects/98/9e5c2c4b1fc947fc3e35ea817eff7224113931
  1. Commit (Commit changes to the repository)
./git-go commit -m "Add test commit"

Example output will be (hash value will be different depending on your file content)

[master c4ab8b32e630f904a8512b8858557c62ea6f1ed2] Add test commit
  1. Log (Show the list of commits)
./git-go log

Example output will be (hash value will be different depending on your file content)

commit c4ab8b32e630f904a8512b8858557c62ea6f1ed2
Author author <[email protected]> 2024-09-26T18:09:28+06:30
Date <[email protected]> 2024-09-26T18:09:28+06:30
        Add test commit
  1. List-files-stage (Show the list of staged files)
./git-go ls-files-stage

Example output will be (hash value will be different depending on your file content)

100644 989e5c2c4b1fc947fc3e35ea817eff7224113931 test.txt
  1. Branch (List, create and delete branch)
./git-go branch dev

Example output will be

New branch call 'dev' is created
./git-go branch

Example output will be

dev
master
./git-go branch -d dev

Example output will be

Branch name 'dev' is deleted

Contribution

All contributions are welcome. You can contribute to refactor the codebase, add more features, and fix the issues. Please open issues or make PR.

License

This project is under MIT LICENSE.

# Packages

Copyright © 2024 Kei-K23 <[email protected]> */.