Commands
This reference is auto-generated from the command registry in cmd/command/. Do not edit this file by hand; run make docs.
For quick lookup, ggc help lists every command and ggc help <command> shows the same detail in your terminal.
Table of contents
Basics
ggc add
Stage changes for the next commit.
Usage:
ggc add <file>
ggc add .
ggc add interactive
ggc add patch
Subcommands:
| Subcommand | Description |
|---|---|
add . |
Add all changes to the index |
add <file> |
Add a specific file to the index |
add interactive |
Add changes interactively |
add patch |
Add changes interactively (patch mode) |
Examples:
ggc add file.txt # Add a specific file
ggc add . # Add all changes to index
ggc add interactive # Add changes interactively
ggc add patch # Add changes interactively (patch mode)
ggc blame
Show what revision and author last modified each line of a file.
Usage:
ggc blame [<options>] <file>
Examples:
ggc blame README.md # Show line authorship for a file
ggc blame -L 10,20 README.md # Limit blame to specific lines
ggc blame -C -C README.md # Detect copy/move across files
ggc grep
Print lines matching a pattern in tracked files.
Usage:
ggc grep [<options>] <pattern> [<pathspec>...]
Examples:
ggc grep TODO # Search tracked files for TODO
ggc grep -n -i fixme # Case-insensitive with line numbers
ggc grep -e foo -e bar -- cmd # Match multiple patterns in cmd/
ggc help
Show help information for commands.
Usage:
ggc help
ggc help <command>
Subcommands:
| Subcommand | Description |
|---|---|
help |
Show main help message |
help <command> |
Show help for a specific command |
Examples:
ggc help
ggc help branch
ggc mv
Move or rename a file, directory, or symlink.
Usage:
ggc mv [<options>] <source>... <destination>
Examples:
ggc mv old.go new.go # Rename a tracked file
ggc mv -k a.go b.go pkg/ # Skip move when destination is in the way
ggc reset
Reset current HEAD to the specified state.
Usage:
ggc reset
ggc reset hard <commit>
ggc reset soft <commit>
Subcommands:
| Subcommand | Description |
|---|---|
reset |
Hard reset to origin/ and clean working directory |
reset hard <commit> |
Hard reset to specified commit |
reset soft <commit> |
Soft reset: move HEAD but keep changes staged |
Examples:
ggc reset # Hard reset to origin/<current-branch> and clean
ggc reset hard HEAD~1 # Hard reset to previous commit
ggc reset soft HEAD~1 # Soft reset: keep changes staged
ggc reset soft HEAD~3 # Soft reset 3 commits, keeping changes staged
ggc rm
Remove files from the working tree and the index.
Usage:
ggc rm [<options>] <file>...
Examples:
ggc rm old.go # Stage removal of a tracked file
ggc rm --cached secret.env # Stop tracking but keep the file on disk
ggc rm -r build/ # Remove a directory recursively
ggc shortlog
Summarize git log output grouped by committer.
Usage:
ggc shortlog [<options>] [<revision-range>]
Examples:
ggc shortlog -sn # Summary count by author
ggc shortlog v1.0..HEAD # Limit to a range
ggc show
Show various types of objects (commits, tags, trees, blobs).
Usage:
ggc show [<options>] [<object>...]
Subcommands:
| Subcommand | Description |
|---|---|
show |
Show HEAD commit |
show --name-only <object> |
Show object with names only |
show --stat <object> |
Show object with diffstat |
show <object> |
Show a specific commit, tag, tree, or blob |
Examples:
ggc show # Show HEAD commit
ggc show HEAD~1 # Show previous commit
ggc show abc1234 # Show a specific commit
ggc show --stat HEAD # Show commit with diffstat
ggc show --name-only HEAD # Show only changed file names
ggc show v1.0.0 # Show a tag
ggc show HEAD:path/to/file.go # Show file contents at HEAD
Branch
ggc branch
List, create, and manage branches.
Usage:
ggc branch <subcommand>
Subcommands:
| Subcommand | Description |
|---|---|
branch checkout |
Switch to an existing branch |
branch checkout remote |
Create and checkout a local branch from the remote |
branch contains <commit> |
Show branches containing a commit |
branch create |
Create and checkout a new branch |
branch current |
Show current branch name |
branch delete |
Delete local branch |
branch delete merged |
Delete local merged branch |
branch info <branch> |
Show detailed branch information |
branch list local |
List local branches |
branch list remote |
List remote branches |
branch list verbose |
Show detailed branch listing |
branch move <branch> <commit> |
Move branch to specified commit |
branch rename <old> <new> |
Rename a branch |
branch set upstream <branch> <upstream> |
Set upstream for a branch |
| `branch sort [date | name]` |
Examples for branch delete:
ggc branch delete feature/123 # Delete a branch
ggc branch delete feature/123 --force # Force delete a branch
Examples:
ggc branch current # Show current branch
ggc branch checkout # Switch to an existing branch
ggc branch checkout remote # Create and checkout a local branch from the remote
ggc branch create feature/login # Create and checkout new branch
ggc branch delete feature/login # Delete local branch
ggc branch delete merged # Delete local merged branch
ggc branch rename old new # Rename a branch
ggc branch move feature abc123 # Move branch to specified commit
ggc branch set upstream feature origin/feature # Set upstream branch
ggc branch info feature # Show detailed branch information
ggc branch list verbose # Show detailed branch listing
ggc branch sort date # List branches sorted by date
ggc branch contains abc123 # Show branches containing a commit
ggc checkout
Switch branches or restore working tree files.
Usage:
ggc checkout [<options>] [<branch>|<commit>] [--] [<path>...]
Examples:
ggc checkout main # Switch to an existing branch
ggc checkout -b feature/login # Create and switch to a new branch
ggc checkout -- path/to/file.go # Discard working-tree changes to a file
ggc checkout HEAD~1 -- path/file.go # Restore a file from a specific commit
ggc merge
Join two or more development histories together.
Usage:
ggc merge [<options>] [<commit>...]
Examples:
ggc merge feature/login # Merge a branch into the current branch
ggc merge --no-ff feature/login # Force a merge commit
ggc merge --squash feature/login # Squash all commits into the index
ggc merge --abort # Abort an in-progress merge
ggc merge --continue # Continue an in-progress merge
ggc switch
Switch branches.
Usage:
ggc switch [<options>] <branch>
Subcommands:
| Subcommand | Description |
|---|---|
switch --detach <ref> |
Detached checkout at a ref |
switch -c <branch> |
Create and switch to a new branch |
switch <branch> |
Switch to an existing branch |
Examples:
ggc switch main # Switch to an existing branch
ggc switch -c feature/login # Create and switch to a new branch
ggc switch -C feature/login # Force-create and switch
ggc switch --detach HEAD~3 # Detached checkout
ggc switch - # Switch back to the previous branch
ggc worktree
Manage multiple working trees.
Usage:
ggc worktree <subcommand> [<options>]
Examples:
ggc worktree list # List linked working trees
ggc worktree add ../wt-feat feature # Add a new working tree
ggc worktree remove ../wt-feat # Remove a linked working tree
ggc worktree prune # Prune stale worktree metadata
Commit
ggc cherry-pick
Apply the changes introduced by some existing commits.
Usage:
ggc cherry-pick [<options>] <commit>...
Examples:
ggc cherry-pick abc1234 # Apply a single commit
ggc cherry-pick -x abc1234 # Apply and append "(cherry picked from ...)"
ggc cherry-pick A..B # Apply a range of commits
ggc cherry-pick --continue # Continue after resolving conflicts
ggc cherry-pick --abort # Abort the in-progress cherry-pick
ggc commit
Create commits from staged changes.
Usage:
ggc commit <message>
ggc commit amend
ggc commit allow empty
ggc commit fixup <commit>
Subcommands:
| Subcommand | Description |
|---|---|
commit <message> |
Create commit with a message |
commit allow empty |
Create an empty commit |
commit amend |
Amend previous commit (editor) |
commit amend no-edit |
Amend without editing commit message |
commit fixup <commit> |
Create a fixup commit targeting |
Examples:
ggc commit "Update docs" # Create commit with a message
ggc commit allow empty # Create an empty commit
ggc commit amend # Amend previous commit (editor)
ggc commit amend no-edit # Amend without editing commit message
ggc commit fixup abc1234 # Create a fixup commit targeting abc1234
ggc log
Inspect commit history.
Usage:
ggc log simple
ggc log graph
Subcommands:
| Subcommand | Description |
|---|---|
log graph |
Show log with graph |
log simple |
Show simple historical log |
Examples:
ggc log simple # Show commit logs in a simple format
ggc log graph # Show commit logs with a graph
ggc revert
Revert some existing commits.
Usage:
ggc revert [<options>] <commit>...
Examples:
ggc revert HEAD # Revert the latest commit
ggc revert --no-edit abc1234 # Revert without editing the message
ggc revert -n abc1234 # Revert without committing (stage only)
ggc revert --continue # Continue after resolving conflicts
ggc revert --abort # Abort the in-progress revert
Remote
ggc fetch
Download objects and refs from remotes.
Usage:
ggc fetch
ggc fetch prune
Subcommands:
| Subcommand | Description |
|---|---|
fetch |
Fetch from the remote |
fetch prune |
Fetch and clean stale references |
Examples:
ggc fetch prune # Fetch and remove stale remote-tracking references
ggc pull
Fetch and integrate from the remote.
Usage:
ggc pull current
ggc pull rebase
Subcommands:
| Subcommand | Description |
|---|---|
pull current |
Pull current branch from remote repository |
pull rebase |
Pull and rebase |
Examples:
ggc pull current # Pull current branch from remote
ggc pull rebase # Pull with rebase
ggc push
Update remote branches.
Usage:
ggc push current
ggc push force
Subcommands:
| Subcommand | Description |
|---|---|
push current |
Push current branch to remote repository |
push force |
Force push current branch |
Examples:
ggc push current # Push current branch to remote
ggc push force # Force push current branch
ggc remote
Manage remotes.
Usage:
ggc remote list
ggc remote add <name> <url>
ggc remote remove <name>
ggc remote set-url <name> <url>
Subcommands:
| Subcommand | Description |
|---|---|
remote add <name> <url> |
Add remote repository |
remote list |
List all remote repositories |
remote remove <name> |
Remove remote repository |
remote set-url <name> <url> |
Change remote URL |
Examples:
ggc remote list
ggc remote add origin git@github.com:user/repo.git
Status
ggc status
Show working tree status.
Usage:
ggc status
ggc status short
Subcommands:
| Subcommand | Description |
|---|---|
status |
Show working tree status |
status short |
Show concise status (porcelain format) |
Examples:
ggc status # Full detailed status output
ggc status short # Short, concise output (porcelain format)
Cleanup
ggc clean
Remove untracked files and directories.
Usage:
ggc clean files
ggc clean dirs
ggc clean interactive
Subcommands:
| Subcommand | Description |
|---|---|
clean dirs |
Clean untracked directories |
clean files |
Clean untracked files |
clean interactive |
Clean files interactively |
Examples:
ggc clean files # Clean untracked files
ggc clean dirs # Clean untracked directories
ggc clean interactive # Clean files interactively
ggc restore
Restore files in working tree or staging area.
Usage:
ggc restore <file>
ggc restore .
ggc restore staged <file>
ggc restore staged .
ggc restore <commit> <file>
Subcommands:
| Subcommand | Description |
|---|---|
restore . |
Restore all files in working directory from index |
restore <commit> <file> |
Restore file from specific commit |
restore <file> |
Restore file in working directory from index |
restore staged . |
Unstage all files |
restore staged <file> |
Unstage file (restore from HEAD to index) |
Examples:
ggc restore staged .
ggc restore main README.md
Diff
ggc diff
Inspect changes between commits, the index, and the working tree.
Usage:
ggc diff [staged|unstaged|head] [--stat|--name-only|--name-status] [<commit>|<commit1> <commit2>] [--] [<path>...]
Subcommands:
| Subcommand | Description |
|---|---|
diff |
Show changes (git diff HEAD) |
diff head |
Alias for default diff against HEAD |
diff staged |
Show staged changes |
diff unstaged |
Show unstaged changes |
Examples:
ggc diff --stat # Show staged + unstaged changes with summary
ggc diff staged cmd/diff.go # Diff staged changes for a file
ggc diff abc123 def456 # Compare two commits
ggc diff abc123 cmd/diff.go # Compare commit to working tree for a path
ggc diff -- cmd/deleted_file.go # Diff a path using -- for disambiguation
ggc range-diff
Compare two commit ranges (e.g. before and after a rebase).
Usage:
ggc range-diff <range1> <range2>
Examples:
ggc range-diff main..@{u} main..HEAD # Compare upstream vs. local rewrite
ggc range-diff abc..def 123..456 # Compare two arbitrary ranges
Tag
ggc tag
Create, list, and manage tags.
Usage:
ggc tag list
ggc tag annotated <tag> <message>
ggc tag delete <tag>
ggc tag show <tag>
ggc tag push [<remote> <tag>]
ggc tag create <tag>
Subcommands:
| Subcommand | Description |
|---|---|
tag annotated <tag> <message> |
Create annotated tag |
tag create <tag> |
Create tag |
tag delete <tag> |
Delete tag |
tag list |
List all tags |
tag push |
Push tags to remote |
tag show <tag> |
Show tag information |
Examples:
ggc tag # List all tags
ggc tag list # List all tags (sorted)
ggc tag list v1.* # List tags matching pattern
ggc tag create v1.0.0 # Create tag
ggc tag create v1.0.0 abc123 # Tag specific commit
ggc tag annotated v1.0.0 'Release notes' # Create annotated tag
ggc tag delete v1.0.0 # Delete tag
ggc tag push # Push all tags to origin
ggc tag push origin v1.0.0 # Push specific tag (remote first)
ggc tag show v1.0.0 # Show tag information
Config
ggc config
Get and set ggc configuration.
Usage:
ggc config list
ggc config get <key>
ggc config set <key> <value>
Subcommands:
| Subcommand | Description |
|---|---|
config get <key> |
Get a specific config value |
config list |
List all configuration |
config set <key> <value> |
Set a configuration value |
Examples:
ggc config list # List all configuration values
ggc config get <key> # Get a config value by key path (e.g., 'ui.color')
ggc config set <key> <value> # Set a config value by key path
Hook
ggc hook
Manage Git hooks.
Usage:
ggc hook <subcommand>
Subcommands:
| Subcommand | Description |
|---|---|
hook disable <hook> |
Disable a hook |
hook edit <hook> |
Edit a hook's contents |
hook enable <hook> |
Enable a hook |
hook install <hook> |
Install a hook |
hook list |
List all hooks |
hook uninstall <hook> |
Uninstall an existing hook |
Examples:
ggc hook list # List all hooks and their status
ggc hook install <hook> # Install a hook
ggc hook enable <hook> # Make a hook executable
ggc hook disable <hook> # Make a hook non-executable
ggc hook uninstall <hook> # Remove a hook
ggc hook edit <hook> # Edit a hook
Rebase
ggc rebase
Reapply commits on top of another base tip.
Usage:
ggc rebase <subcommand>
Subcommands:
| Subcommand | Description |
|---|---|
rebase <upstream> |
Rebase current branch onto |
rebase abort |
Abort an in-progress rebase |
rebase autosquash |
Interactive rebase with --autosquash |
rebase continue |
Continue an in-progress rebase |
rebase interactive |
Interactive rebase |
rebase skip |
Skip current patch and continue |
Examples:
ggc rebase interactive # Interactive rebase
ggc rebase autosquash # Interactive rebase with --autosquash
ggc rebase main # Rebase current branch onto 'main'
ggc rebase continue # Continue an in-progress rebase
ggc rebase abort # Abort an in-progress rebase
ggc rebase skip # Skip current patch and continue
Stash
ggc stash
Save and reapply work-in-progress changes.
Usage:
ggc stash <subcommand>
Subcommands:
| Subcommand | Description |
|---|---|
stash |
Stash current changes |
stash apply |
Apply stash without removing it |
stash apply <stash> |
Apply specific stash without removing it |
stash branch <branch> |
Create branch from stash |
stash branch <branch> <stash> |
Create branch from specific stash |
stash clear |
Remove all stashes |
stash create |
Create stash and return object name |
stash drop |
Remove the latest stash |
stash drop <stash> |
Remove specific stash |
stash list |
List all stashes |
stash pop |
Apply and remove the latest stash |
stash pop <stash> |
Apply and remove specific stash |
stash push |
Save changes to new stash |
stash push -m <message> |
Save changes to new stash with message |
stash save <message> |
Save changes to new stash with message |
stash show |
Show changes in stash |
stash show <stash> |
Show changes in specific stash |
stash store <object> |
Store stash object |
Examples:
ggc stash # Stash current changes
ggc stash list # List all stashes
ggc stash show [stash] # Show changes in stash
ggc stash apply [stash] # Apply stash without removing it
ggc stash pop [stash] # Apply and remove stash
ggc stash drop [stash] # Remove stash
ggc stash branch <branch> [stash] # Create branch from stash
ggc stash push [-m message] [files] # Save changes to new stash
ggc stash save [message] # Save changes to new stash
ggc stash clear # Remove all stashes
ggc stash create # Create stash and return object name
ggc stash store <object> # Store stash object
Utility
ggc am
Apply a series of patches from a mailbox.
Usage:
ggc am [<options>] [<mailbox>...]
Examples:
ggc am 0001-fix-bug.patch # Apply a single patch
ggc am --continue # Continue after resolving conflicts
ggc am --abort # Abort the in-progress am
ggc archive
Create an archive of files from a named tree.
Usage:
ggc archive [<options>] <tree-ish> [<path>...]
Examples:
ggc archive -o out.tar.gz HEAD # Archive current HEAD to a tarball
ggc archive --format=zip -o v1.zip v1 # Archive a tag as a zip
ggc bisect
Use binary search to find the commit that introduced a bug.
Usage:
ggc bisect <subcommand> [<options>]
Examples:
ggc bisect start # Start a new bisect session
ggc bisect bad # Mark current commit as bad
ggc bisect good v1.0.0 # Mark a known-good commit
ggc bisect reset # Finish bisecting
ggc completion
Print or install shell completion scripts.
Usage:
ggc completion <bash|zsh|fish>
ggc completion install <bash|zsh|fish>
Subcommands:
| Subcommand | Description |
|---|---|
completion bash |
Print bash completion script |
completion fish |
Print fish completion script |
completion install <shell> |
Install the completion script for <bash |
completion zsh |
Print zsh completion script |
Examples:
ggc completion bash # Print the bash completion to stdout
ggc completion install zsh # Install zsh completion under ~/.zsh/completions/
ggc completion fish > ~/.config/fish/completions/ggc.fish
ggc debug-keys
Debug keybinding issues and capture raw key sequences.
Usage:
ggc debug-keys
ggc debug-keys raw
ggc debug-keys raw <file>
Subcommands:
| Subcommand | Description |
|---|---|
debug-keys |
Show current keybindings |
debug-keys raw |
Capture key sequences interactively |
debug-keys raw <file> |
Capture key sequences and save them to a file |
Examples:
ggc debug-keys # Show active keybindings
ggc debug-keys raw # Capture key sequences interactively
ggc debug-keys raw keys.txt # Capture and save to keys.txt
ggc describe
Give an object a human-readable name based on an available ref.
Usage:
ggc describe [<options>] [<commit>]
Examples:
ggc describe # Describe current HEAD
ggc describe --tags # Use any tag, not just annotated ones
ggc describe --always --dirty # Always emit a string; mark dirty trees
ggc doctor
Diagnose the local ggc installation.
Usage:
ggc doctor
Examples:
ggc doctor # Check git binary, config, shell completions, TTY, etc.
ggc format-patch
Prepare patches for e-mail submission.
Usage:
ggc format-patch [<options>] <commit-range>
Examples:
ggc format-patch -1 HEAD # Produce a patch for the latest commit
ggc format-patch origin/main..HEAD # Produce patches for a branch
ggc fsck
Verify the connectivity and validity of objects in the repository.
Usage:
ggc fsck [<options>]
Examples:
ggc fsck # Run a basic fsck
ggc fsck --full --strict # Comprehensive checks
ggc gc
Cleanup unnecessary files and optimize the local repository.
Usage:
ggc gc [<options>]
Examples:
ggc gc # Run a normal gc
ggc gc --aggressive --prune=now # Aggressively repack and prune
ggc history
Show ggc command history.
Usage:
ggc history
ggc history <N>
ggc history last <N>
ggc history search <pattern>
ggc history clear
Subcommands:
| Subcommand | Description |
|---|---|
history |
Show recent commands |
history <N> |
Show the last N commands (shorthand for last N) |
history clear |
Delete every recorded entry |
history last <N> |
Show last N commands |
history search <pattern> |
Search past commands |
Examples:
ggc history # Show recent ggc commands
ggc history 20 # Show the last 20 commands (shorthand)
ggc history last 50 # Show last 50 commands
ggc history search push # Search history for 'push'
ggc history clear # Delete every recorded entry
ggc maintenance
Run scheduled background repository optimizations.
Usage:
ggc maintenance <subcommand> [<options>]
Examples:
ggc maintenance run # Run all enabled tasks once
ggc maintenance start # Install scheduled maintenance
ggc maintenance stop # Remove scheduled maintenance
ggc notes
Add, read, or edit object notes.
Usage:
ggc notes <subcommand> [<options>]
Examples:
ggc notes add -m "reviewed" HEAD # Attach a note to HEAD
ggc notes show HEAD # Show a note
ggc notes list # List notes
ggc prune
Prune all unreachable objects from the object database.
Usage:
ggc prune [<options>]
Examples:
ggc prune # Prune unreachable objects
ggc prune --dry-run # Report what would be pruned
ggc quit
Exit interactive mode.
Usage:
quit
Examples:
quit
ggc reflog
Manage reflog information (recovery aid).
Usage:
ggc reflog [<subcommand>] [<options>] [<ref>]
Examples:
ggc reflog # Show HEAD reflog
ggc reflog show main # Show reflog for a specific ref
ggc reflog expire --expire=now --all # Aggressively expire reflog entries
ggc sparse-checkout
Reduce the working tree to a subset of tracked files.
Usage:
ggc sparse-checkout <subcommand> [<options>]
Examples:
ggc sparse-checkout init --cone # Enable sparse-checkout in cone mode
ggc sparse-checkout set src docs # Limit working tree to these paths
ggc sparse-checkout list # Show currently checked-out paths
ggc sparse-checkout disable # Disable sparse-checkout
ggc submodule
Initialize, update, or inspect submodules.
Usage:
ggc submodule <subcommand> [<options>]
Examples:
ggc submodule status # Show submodule status
ggc submodule update --init # Initialize and update submodules
ggc submodule foreach git status # Run a command in each submodule
ggc version
Display current ggc version.
Usage:
ggc version
ggc version json
Subcommands:
| Subcommand | Description |
|---|---|
version json |
Emit the version information as a JSON document |
Examples:
ggc version # Human-readable version, commit, build time, os/arch
ggc version json # Same info as a JSON document for scripting