git-cli
Overview
git-cli is a Rust CLI that groups Git workflow helpers behind a dispatcher. It provides five command groups: utils, reset, commit, branch, and ci.
Usage
Usage:
git-cli <group> <command> [args]
Groups:
utils zip | copy-staged | root | commit-hash
reset soft | mixed | hard | undo | back-head | back-checkout | remote
commit context | context-json | to-stash
branch cleanup
ci pick
Help:
git-cli help
git-cli <group> help
Commands
utils
zip: Createbackup-<short-sha>.zipfromHEADusinggit archive.copy-staged(copy): Copy staged diff to the clipboard. Use--stdoutto 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,--both,--no-color(orNO_COLOR),--include <path/glob>(repeatable).context-json: Writecommit-context.jsonandstaged.patch(default:<git-dir>/commit-context). Options:--stdout,--both,--pretty,--bundle,--out-dir <path>.to-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.
ci
pick: Create and push aci/<target>/<name>branch with cherry-picked commits. Options:-r/--remote <name>,--no-fetch,-f/--force,--stay.
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 tools are optional:
pbcopy,wl-copy,xclip, orxsel. Missing clipboard tools emit a warning and continue.