git-cli
Overview
git-cli is a Rust CLI that groups Git workflow helpers behind a dispatcher. It exposes seven
command groups (utils, reset, commit, branch, ci, open, completion) with consistent
help / version handling: git-cli help (or -h/--help) prints top-level usage, git-cli <group> help prints group usage, and git-cli -V/--version prints the binary version.
Usage
Invoke as git-cli <group> <command> [args]. The dispatcher recognizes these groups and
subcommands (matching the binary's --help output):
utils:zip,copy-staged(aliascopy),root,commit-hash(aliashash).reset:soft,mixed,hard,undo,back-head,back-checkout,remote.commit:context,context-json(aliasescontext_json,contextjson,json),to-stash(aliasstash).branch:cleanup(aliasdelete-merged).ci:pick.open:repo,branch,default-branch(aliasdefault),commit,compare,pr(aliasespull-request,mr,merge-request),pulls(aliasesprs,merge-requests,mrs),issues(aliasissue),actions(aliasaction),releases(aliasrelease),tags(aliastag),commits(aliashistory),file(aliasblob),blame.completion:bash,zsh(writes a clap-generated completion script to stdout).
Commands
utils
zip: Createbackup-<short-sha>.zipfromHEADusinggit archive.copy-staged(copy): Copy staged diff to the clipboard. Use--stdout(-p/--print) to print,--bothto print and copy.root: Print the repository root. Use--shellto outputcd -- <path>foreval.commit-hash(hash): Resolve a ref to a commit SHA.
reset
soft|mixed|hard [N]: RewindHEADby N commits (default: 1) with confirmations and summaries.undo: MoveHEADback to the previous reflog entry with safety checks.back-head: CheckoutHEAD@{1}(previous position).back-checkout: Checkout the previously checked-out branch (requires non-detachedHEAD).remote: Reset the current branch to a remote-tracking ref. Options:--ref <remote/branch>,--remote <name>,--branch <name>,--no-fetch,--prune,--set-upstream,--clean,-y/--yes.
commit
context: Build a Markdown commit context from staged changes. Options:--stdout(-p/--print),--both,--no-color(orNO_COLOR),--include <path/glob>(repeatable).context-json(aliasescontext_json,contextjson,json): Writecommit-context.jsonandstaged.patch(default:<git-dir>/commit-context). Options:--stdout,--both,--pretty,--bundle,--out-dir <path>.to-stash(stash): Create a stash from a commit and optionally rewrite history via prompts.
branch
cleanup(delete-merged): Delete merged local branches. Options:-b/--base <ref>,-s/--squash,-w/--remove-worktrees.
ci
pick: Create and push aci/<target>/<name>branch with cherry-picked commits. Options:-r/--remote <name>,--no-fetch,-f/--force,--stay.
open
repo [remote]: Open repository homepage.branch [ref]: Open tree page for a ref (default: upstream branch).default-branch [remote](default): Open default branch tree page.commit [ref]: Open commit page (default:HEAD).compare [base] [head]: Open compare page.pr [number](pull-request,mr,merge-request): Open PR/MR page or create/view current-branch PR. On GitHub remotes, prefersgh pr view --webwhen available.pulls [number](prs,merge-requests,mrs): Open PR/MR list or specific PR/MR.issues [number](issue): Open issue list or specific issue.actions [workflow](action): Open GitHub Actions page (GitHub only). Workflow may be a file name (ci.yml/ci.yaml) for the workflow page, or any other token for an actions search.releases [tag](release): Open releases list or specific release tag.tags [tag](tag): Open tags list or specific release tag.commits [ref](history): Open commits history page.file <path> [ref](blob): Open file blob page.blame <path> [ref]: Open blame page.GIT_OPEN_COLLAB_REMOTEcan override the remote used for collaboration pages (pr/pulls/issues/actions/releases/tags).
completion
bash/zsh: Print a clap-generated shell completion script to stdout (suitable forsource <(git-cli completion zsh)). Any extra arguments are rejected.
Shell aliases (optional)
- Zsh aliases live in
completions/zsh/aliases.zsh. - Bash aliases live in
completions/bash/aliases.bash. gxurshould be implemented via:eval "$(git-cli utils root --shell)".
Exit codes
0: Success and help output.1: Operational errors or aborted confirmations.2: Usage/parse errors.
Dependencies
gitis required for all commands.git-scopeis required forcommit context.- Clipboard integration via
nils-common::clipboardprobespbcopy,wl-copy,xclip, thenxsel(in that order) forcommit context,utils copy-staged, and any other clipboard consumer. Missing or failing clipboard tools emit a warning and the command continues. See the workspaceBINARY_DEPENDENCIES.mdfor install hints. ghis preferred for GitHub PR pages (open pr); without it the CLI falls back to the GitHub compare URL.fileis optionally used for MIME-based binary detection incommit context.