Skip to content

Repository files navigation

gmc

gmc logo

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.

Release Version go report MIT License

Installation

Homebrew (macOS/Linux)

brew install samzong/tap/gmc
# or
go install github.com/samzong/gmc@latest

Features

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 <temp> <name> Rename a .dup-N branch to a permanent name
gmc wt list List all worktrees in the family
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
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

Rust dependency cache

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.

Config

Config lives at ~/.config/gmc/config.yaml (legacy ~/.gmc.yaml still works; a project-level .gmc.yaml overrides global). Run gmc init for a guided setup, or set fields manually:

gmc config set apibase https://api.openai.com/v1
gmc config set apikey  sk-...
gmc config set model   gpt-4.1-mini
gmc config set role    "Backend Developer"

Custom prompt template: set prompt_template to a YAML file path with {{.Role}}, {{.Files}}, {{.Diff}} variables. See docs/.

Task workflow

gmc task uses an embedded plan -> code -> review -> ship workflow when no user workflow is configured. The default reference lives at internal/task/default_workflow.yaml.

To customize it:

mkdir -p ~/.config/gmc
cp internal/task/default_workflow.yaml ~/.config/gmc/workflow.yaml

Shell completion

gmc completion zsh  > ~/.zsh/completions/_gmc
gmc completion bash > ~/.bash_completion.d/gmc

Troubleshooting

oh-my-zsh git plugin conflicts with gmc

If 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/null

Then 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 version

If you still want a short alias for git merge --continue, pick a different name (for example gmcont) before removing gmc.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Parallel git worktrees for parallel AI agents — plus AI-generated commits.

Topics

Resources

Contributing

Security policy

Stars

19 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages