Lazy Git Push command
  • Go 90.9%
  • Shell 9.1%
Find a file
j e1244c664e
All checks were successful
Build-Test-Publish / build (push) Successful in 27s
Fix example router URL in README
2026-09-20 12:22:41 +12:00
.gitea/workflows Cross-build gp for all platforms on one runner 2026-06-13 21:11:57 +12:00
.gitignore Rewrite gp as a Go program with configurable LLM, multi-repo support, 2026-05-10 10:33:02 +12:00
build.sh Rewrite gp as a Go program with configurable LLM, multi-repo support, 2026-05-10 10:33:02 +12:00
ci.go Read GitHub PAT from ~/.config/github-ci/token as a fallback 2026-08-25 13:38:18 +12:00
ci_test.go Read GitHub PAT from ~/.config/github-ci/token as a fallback 2026-08-25 13:38:18 +12:00
display.go Default confirm prompts to yes on empty input 2026-05-12 23:37:31 +12:00
git.go refuse git repos rooted at filesystem root or top-level directories 2026-09-09 22:09:36 +12:00
git_test.go refuse git repos rooted at filesystem root or top-level directories 2026-09-09 22:09:36 +12:00
go.mod Rewrite gp as a Go program with configurable LLM, multi-repo support, 2026-05-10 10:33:02 +12:00
llm.go feat: add max diff size limit to skip LLM and use heuristic fallback 2026-06-15 14:51:04 +12:00
llm_test.go Add LLM source tracking to commit message generation 2026-05-13 22:11:59 +12:00
main.go Add home directory boundary guard for repo root discovery 2026-09-09 21:57:38 +12:00
publish.sh Cross-build gp for all platforms on one runner 2026-06-13 21:11:57 +12:00
README.md Fix example router URL in README 2026-09-20 12:22:41 +12:00
setup_script.sh Replace commit-msg with ask utility for LLM commit messages 2026-05-13 12:56:40 +12:00
test.sh Add Go PATH detection to test.sh for non-interactive shells 2026-05-10 10:34:51 +12:00

gp - Git Push

Add, commit, and push in one command.

Generates commit messages using a configurable LLM with a heuristic fallback. Supports pushing multiple repos and waiting for all CI workflows in parallel.

Install

getpkg install gp

Usage

gp                              # Add all, auto-generate commit message, push
gp "Fix the parser"             # Custom commit message
gp --dry-run                    # Preview without executing
gp --staged-only                # Only commit staged changes
gp -y                           # Skip confirmations
gp -b develop                   # Push to a specific branch
gp --no-wait                    # Don't wait for CI after push
gp --llm ask                    # Use ask for commit messages
gp -y repo1/ repo2/ repo3/     # Push multiple repos, parallel CI wait

Options

Option Description
-n, --dry-run Preview changes without executing
-f, --force Skip all confirmations
-y, --yes Auto-answer yes to prompts
-a, --add-all Add all files including untracked (default)
--staged-only Only commit staged changes
-b, --branch Push to specified branch
--no-wait Skip waiting for CI workflow
--llm NAME LLM for commit messages (see below)

Commit Message Generation

The LLM used for commit messages is configurable via --llm, GP_LLM env var, or git config gp.llm:

Value Description
auto Try ask, claude, ollama, then heuristic (default)
ask Use the ask utility, configured by ~/.config/ask/ask.env
claude Use Claude CLI (claude --print)
ollama Use Ollama API with default model (qwen2.5:0.5b)
ollama:MODEL Use Ollama API with a specific model (e.g. ollama:qwen2.5:1.5b)
none Heuristic only, no LLM

ask reads its router settings from ~/.config/ask/ask.env, usually LLM_ROUTER_URL="http://epyc.home:8585". When ask is used, gp runs it with -v and reports the routed model when ask includes one, for example ask:qwen3.6-27b-fp8. Generated messages are shown with their source, for example Generated commit message using ask:qwen3.6-27b-fp8: 'Update gp commit message reporting'.

The Ollama API URL defaults to http://localhost:11434 and can be changed with GP_OLLAMA_URL or git config gp.ollama-url.

Heuristic fallback examples:

  • Single file: Add src/auth.py, Update README.md, Remove old_config.json
  • Multiple files: feat: Add 2 and update 3 files, docs: Update 2 files

Multi-Repo

Pass directory arguments to commit and push multiple repos, then wait for all CI workflows in parallel:

gp -y repo1/ repo2/ repo3/

Each repo gets its own auto-generated commit message. All commits and pushes happen first, then all CI workflows are monitored simultaneously. This replaces the old waterfall pattern of running gp in each repo one at a time.

Repository Boundary

Git's repo discovery walks up through every parent directory, so a stray .git at ~ or / would otherwise make gp treat your whole home directory — or the whole filesystem — as one repo, and git add -A it. Two limits prevent that:

  • The filesystem root and top-level directories are never valid repo roots. A root must be at least two components deep, so /srv/work is fine but /srv and / are refused.
  • When you run gp at or below your home directory, the repo root must be a strict subdirectory of it — anything at ~ or higher is refused.
[ERROR] refusing to use the git repository at /home/j: it is at or above your home directory (/home/j)
[ERROR] refusing to use the git repository at /srv: it is a top-level directory

Note for containers: a project checked out at a top-level path like /app or /workspace is refused by the first rule.

CI Workflow Monitoring

After pushing to a Gitea remote, gp automatically monitors CI workflow progress:

[INFO] Waiting for CI workflows... (press ESC to stop)

  myproject
    ✓ build (linux/amd64)
    ⠹ build (linux/arm64) running
  otherproject
    ⠋ build (linux/amd64) running
    · build (linux/arm64) queued
  • Press ESC at any time to stop waiting (CI continues in background)
  • Requires a Gitea API token (from the remote URL, GITEA_TOKEN env, or git credential store)
  • Automatically skipped for GitHub/GitLab remotes or when no token is available
  • Use --no-wait to disable

Config Defaults

Set per-repo or global defaults via git config:

git config gp.auto-yes true           # Skip confirmations (like -y)
git config gp.wait false              # Don't wait for CI (like --no-wait)
git config gp.llm ask                 # Default LLM for commit messages
git config gp.ollama-url http://...   # Ollama API URL
git config --global gp.llm claude     # Apply globally