A Git implementation written in Go.
Note: This is pretty much WIP and some things may be broken in some cases. There are no docs. and code comments are almost non-existing but these will be worked on when the implementation is stabilized (if ever). You're welcome to create PR and fix bugs, add features etc.
Note 2: Since I'm operating with Unix style file metadata and I don't really care about Windows implementation right now - Windows is not supported.
Note 3: Git credential helpers (like git-credential-store, git-credential-osxkeychain, etc.) are not yet supported. You must configure authentication manually (see here).
Download the latest binary from the GitHub releases page
- Go 1.23 or later
git clone https://github.com/unkn0wn-root/git-go.git
cd git-go
go mod download
go build -o git-go# Initialize a new repository
./git-go init [directory]
# Check repository status
./git-go status# Add files to staging area
./git-go add <file>...
./git-go add . # Add all files
./git-go add src/ # Add directory recursively
# Create commit
./git-go commit -m "Commit message"
./git-go commit -m "Message" --author-name "Name" --author-email "hello@local.repo"# View commit history
./git-go log
./git-go log --oneline # Condensed format
./git-go log --max-count 10 # Limit to 10 commits
./git-go log -n 5 # Limit to 5 commits
# Show differences
./git-go diff # Working tree vs staging area
./git-go diff --staged # Staging area vs last commit
./git-go diff --cached # Alternative to --staged
./git-go diff file.txt # Specific file differences
# Line-by-line authorship
./git-go blame <file># Reset modes
./git-go reset # Mixed reset to HEAD
./git-go reset --soft <commit> # Move HEAD only
./git-go reset --mixed <commit> # Move HEAD and reset index
./git-go reset --hard <commit> # Move HEAD, reset index and working tree
# Path-specific reset
./git-go reset <commit> -- <file>...
./git-go reset HEAD -- file.txt# Remote management
./git-go remote add origin <url>
./git-go remote list
./git-go remote show origin
# Clone repository
./git-go clone <url> [directory]
# Pull/Push operations
./git-go pull [remote] [branch]
./git-go push [remote] [branch]For GitHub repositories, use a Personal Access Token (PAT):
# Set your GitHub token
export GITHUB_TOKEN="your_personal_access_token"
# Then use HTTPS URLs
./git-go clone https://github.com/username/repo.git
./git-go push origin mainFor GitLab repositories, use a Personal Access Token:
# Set your GitLab token
export GITLAB_TOKEN="your_personal_access_token"
# Then use HTTPS URLs
./git-go clone https://gitlab.com/username/repo.git
./git-go push origin mainSSH authentication is supported using:
-
SSH Agent (recommended):
# Start ssh-agent and add your key eval $(ssh-agent -s) ssh-add ~/.ssh/id_rsa # Use SSH URLs ./git-go clone git@github.com:username/repo.git
-
Direct SSH Key:
# Will automatically discover keys in ~/.ssh/ # Supports: id_rsa, id_ed25519, id_ecdsa ./git-go clone git@github.com:username/repo.git
For repositories requiring username/password:
export GIT_USERNAME="your_username"
export GIT_PASSWORD="your_password"
./git-go clone https://superdomain.lucky/repo.gitGitHub:
- Go to GitHub Settings -> Developer settings -> Personal access tokens
- Generate new token with needed permissions (repo, etc.)
- Copy the token and set it as
GITHUB_TOKEN
GitLab:
- Go to GitLab User Settings -> Access Tokens
- Create new token with scopes (read_repository, write_repository, etc.)
- Copy the token and set it as
GITLAB_TOKEN
go test ./...
# with coverage
go test -cover ./...git-go tries to maintain full compatibility with standard Git repositories:
- Objects created by git-go can be read by Git
- Repositories initialized by git-go work with Git commands
- Index files are fully (or should be) compatible between implementations
- Reference structure follows Git conventions