Parallel worktrees for parallel AI agents — plus AI-generated commits.
A Git workflow CLI built for the AI coding era: spin up a worktree per agent, share .env and node_modules across them, and let an LLM write the commit when you're done.
The v1.0.0 public contracts describe CLI compatibility, JSON fields, exit codes, and configuration precedence.
brew install samzong/tap/gmc
# or
go install github.com/samzong/gmc@latest| Command | What it does |
|---|---|
| Worktree — parallel AI development | |
gmc wt clone <url> [--upstream <url>] |
Clone as .bare/ + worktree layout, optionally register upstream |
gmc wt add <name> [-b <base>] [--sync] |
New worktree on a new branch |
gmc wt dup [N] [-b <base>] |
Fan out N sibling worktrees for parallel agents |
gmc wt promote <candidate> |
Apply a candidate's changes into the current worktree |
gmc wt list |
List all worktrees in the family with each one's allocated disk size |
gmc wt list -A |
Scan home for repositories with linked worktrees; show each family's local status |
gmc wt switch |
Interactive switch between worktrees |
gmc wt remove <name> [-D] |
Delete worktree (and optionally its branch) |
gmc wt sync |
Pull the base branch up to date |
gmc wt share add <path> |
Share .env / node_modules / venv across worktrees |
gmc wt pr-review <pr-number> |
Spin up a worktree from a GitHub PR |
gmc wt prune |
Remove worktrees whose branches are merged; --all runs across repositories with linked worktrees in the home directory |
| Commit — AI message generation | |
gmc |
Generate Conventional Commits message from staged diff |
gmc -a [paths...] |
Stage (all or given paths), then commit |
gmc --branch <desc> |
Generate a branch name, switch, then commit |
gmc --issue <N> |
Append (#N) to the subject |
gmc --prompt <text> |
Extra instruction for the LLM |
gmc --dry-run |
Generate but don't commit |
gmc -y / --no-verify / --no-signoff |
Auto-confirm / skip hooks / skip signoff |
| Other | |
gmc tag [-y] |
Suggest and create the next semver tag |
gmc init |
Interactive setup wizard |
gmc config set <key> <value> / gmc config get |
Manage config |
gmc --output json |
Machine-readable output for agents and CI |
gmc completion zsh|bash|fish |
Shell completion |
New Rust worktrees automatically cache dependencies with Kache. Keep using the same gmc and Cargo commands; no separate installation or configuration is required. Packages selected by Cargo retain native incremental compilation, and each worktree keeps its own target directory.
Setup discovers root and nested Cargo.toml files, including multiple Rust projects in a monorepo.
Parent Rust roots cover their descendants; existing .cargo directories or compiler wrappers are preserved.
Dependency/build directories, symbolic links, and nested Git repositories are excluded from discovery.
It adds ignored local Cargo configuration without changing global configuration or tracked files.
The first eligible creation downloads a pinned, checksum-verified Kache release. Tools and a local
cache capped at 10 GiB live under ${XDG_DATA_HOME:-~/.local/share}/gmc/rust-cache.
Unavailable setup leaves normal Cargo builds available; diagnostics use gmc's existing --debug flag.
Configuration lives at ~/.config/gmc/config.yaml. The legacy ~/.gmc.yaml path still works. A project-level .gmc.yaml is untrusted and can set only role, model, and enable_emoji. It cannot set api_key, api_base, or prompt_template. An explicit --config or GMC_CONFIG skips project configuration, and other GMC_* variables take precedence over project values. gmc reports ignored project settings on stderr.
gmc stores API keys in macOS Keychain, Linux Secret Service, or Windows Credential Manager. Each credential uses the resolved absolute path of its configuration file. If you move the file, set the key again. GMC_API_KEY takes precedence over OS credential storage, which takes precedence over a legacy file key.
gmc does not move file keys automatically or change the configuration file at startup. When a command uses a file key, gmc warns once on stderr that the key is in plaintext. Run gmc config set apikey to enter a key and move it to OS credential storage. After storage succeeds, gmc removes all direct case variants of api_key from the file. The values of those variants do not need to match.
Commands that do not need a key, such as version, wt, and completion, do not read OS credential storage or show key warnings. If gmc cannot read OS credential storage, it warns when a command needs the key. It can still use a file key. Saving other configuration values keeps existing file keys and never copies an environment or stored key into the file.
If OS credential storage is unavailable when you set a new key, the command fails and leaves the file unchanged. Set GMC_API_KEY instead. In gmc init, leave the key blank to keep the current key without storing it again. A new key follows the same storage and file-removal steps as gmc config set apikey. On macOS, gmc uses /usr/bin/security, so other programs running as your user can still read the key.
Run gmc init for a guided setup, or set fields manually:
gmc config set apibase https://api.openai.com/v1
gmc config set apikey
gmc config set model gpt-4.1-mini
gmc config set role "Backend Developer"gmc config set apikey reads the key from a hidden terminal prompt. It does not accept the key as a command-line argument.
Set worktree.root (e.g. /Volumes/git/worktrees) in the global config to create new worktrees at <root>/<owner>/<repo>/<repo>--<name>; gmc locks them so an unmounted disk does not lose their Git records, and falls back to the old location with a warning when the root is missing.
Custom prompt template: set prompt_template to a YAML file whose template key holds a prompt using the {{.Role}}, {{.Files}} and {{.Diff}} variables. A file without a template key, or an empty one, is reported and the built-in template is used instead.
template: |
{{.Role}}, summarize the changes below as one Conventional Commits line.
Files:
{{.Files}}
Diff:
{{.Diff}}gmc task manages local AI coding tasks on a repo-family ledger: worktree, agent session, runs, events, and logs.
gmc task add "Fix worktree cleanup"
gmc task start <task-id> # create worktree, launch agent in tmux
gmc task run <task-id> -- go test ./... # headless run, recorded with logs
gmc task advance <task-id> # move to the next workflow node
gmc task show <task-id> # status, runs, warnings
gmc task refresh # reconcile records with runtime state
gmc task gc # dry-run cleanup; --apply kills live, unattached sessions of finished nodes or done tasksIt uses an embedded plan -> code -> review -> ship workflow when no user workflow is configured. The built-in workflow runs each agent with its own approval settings — nothing bypasses prompts or sandboxes. The launched command is printed as command: on start and advance. The default reference lives at internal/task/default_workflow.yaml.
To customize it — or to run agents unattended by setting explicit node commands:
mkdir -p ~/.config/gmc
cp internal/task/default_workflow.yaml ~/.config/gmc/workflow.yamlA workflow.yaml replaces the built-in workflow entirely.
gmc completion zsh > ~/.zsh/completions/_gmc
gmc completion bash > ~/.bash_completion.d/gmcIf you use oh-my-zsh with the git plugin enabled, it defines:
alias gmc='git merge --continue'That alias shadows the gmc CLI, so commands like gmc or gmc version run git merge --continue instead.
Fix: add this to ~/.zshrc after source $ZSH/oh-my-zsh.sh:
unalias gmc 2>/dev/nullThen reload your shell (source ~/.zshrc) or open a new terminal.
Workaround without changing config: prefix the command to bypass the alias:
\gmc version
# or
command gmc versionIf you still want a short alias for git merge --continue, pick a different name (for example gmcont) before removing gmc.
This project is licensed under the MIT License - see the LICENSE file for details