由 PostgreSQL 提供支持的类似 Git 的版本控制 CLI,采用 pg-xpatch delta 压缩
A Git-like version control CLI backed by PostgreSQL with pg-xpatch delta compression.
Note: pgit is primarily a demo for pg-xpatch delta compression. It's not intended to replace git—but it is genuinely useful for importing a repo and running SQL analytics on your commit history.
Import any git repo. Analyze it instantly.
pgit init
pgit import /path/to/your/repo --branch main
pgit analyze couplingNo scripts, no parsing git log output. Just answers.
file_a file_b commits_together
──────────────────────── ──────────────────────── ────────────────
src/parser.rs src/lexer.rs 127
src/db/schema.go src/db/migrations.go 84
README.md CHANGELOG.md 63Need something custom? Everything is in PostgreSQL — write your own SQL:
…bash
go build -o pgit-bench ./cmd/pgit-bench/
./pgit-bench --file bench_repos.txt --parallel 3 --report BENCHMARK.md
The repo list in [`bench_repos.txt`](bench_repos.txt) covers 20 projects across 6 languages (Rust, Go, Python, JavaScript, TypeScript, C) — from small utilities like jq (1.9k commits) to large projects like git (80k commits).
You can also benchmark individual repos:
```bash
./pgit-bench https://github.com/tokio-rs/tokio
…
bash
# Start a pg-xpatch container (creates database 'myproject' automatically)
docker run -d --name pgit-remote \
-e POSTGRES_USER=pgit \
-e POSTGRES_PASSWORD=pgit \
-e POSTGRES_DB=myproject \
-p 5433:5432 \
ghcr.io/imgajeed76/pg-xpatch:latest
# Add it as a remote and push
pgit remote add origin postgres://pgit:pgit@localhost:5433/myproject
pgit push originThe database name can be anything you want - just make sure it matches in both the container and the connection URL. pgit will initialize the schema automatically on first push.
# Bash
pgit completion bash > /etc/bash_completion.d/pgit
# Zsh
pgit completion zsh > "${fpath[1]}/_pgit"
# Fish
pgit completion fish > ~/.config/fish/completions/pgit.fish| Variable | Description |
|---|---|
PGIT_CONTAINER_RUNTIME |
Force docker or podman |
PGIT_ACCESSIBLE |
Set to 1 for accessibility mode (no animations) |
NO_COLOR |
Disable colored output |
MIT
Built with ❤️ by Oliver Seifert
暂无开放 Issues,或尚未同步最近议题。