Configuration
git-gud uses a layered configuration system:
- Global config:
~/.config/gg/config.json— shared defaults across all repos - Local config:
.git/gg/config.json— per-repository settings
Local config always takes precedence over global config.
Setup
Initialize or update local config with:
gg setup # Quick mode: essential settings only
gg setup --all # Full mode: all settings organized by category
For global config, manually create ~/.config/gg/config.json with your preferred defaults.
Example config
{
"defaults": {
"provider": "gitlab",
"base": "main",
"branch_username": "your-username",
"lint": [
"cargo fmt --check",
"cargo clippy -- -D warnings"
],
"auto_add_gg_ids": true,
"unstaged_action": "ask",
"land_wait_timeout_minutes": 30,
"land_admin": false,
"land_auto_clean": false,
"sync_auto_lint": false,
"sync_auto_rebase": false,
"sync_behind_threshold": 1,
"sync_draft": false,
"sync_update_descriptions": true,
"sync_update_title": false,
"worktree_base_path": "/tmp/gg-worktrees",
"github": {
"stacks_integration": "auto"
},
"gitlab": {
"auto_merge_on_land": false
}
}
}
defaults options
| Option | Type | What it controls | Default |
|---|---|---|---|
provider | string | Provider (github/gitlab) for self-hosted or explicit override | Auto-detected |
base | string | Default base branch for new stacks | Auto-detected |
branch_username | string | Username prefix in stack/entry branch names | Auto-detected |
lint | string[] | Commands used by gg lint / gg sync --lint | [] |
auto_add_gg_ids | boolean | Deprecated compatibility field. gg always enforces GG metadata normalization, regardless of this value. | true |
unstaged_action | string | Default behavior for gg sc/gg amend when unstaged changes exist: ask, add, stash, continue, or abort | ask |
land_wait_timeout_minutes | number | Timeout for gg land --wait polling | 30 |
land_admin | boolean | Use admin privileges to bypass approval requirements on land (GitHub only) | false |
land_auto_clean | boolean | Auto-run cleanup after full landing | false |
sync_auto_lint | boolean | Automatically run gg lint before gg sync | false |
sync_auto_rebase | boolean | Automatically run gg rebase before gg sync when behind threshold is reached | false |
sync_behind_threshold | number | Warn/rebase in gg sync when base is at least this many commits behind origin/<base> (0 disables check) | 1 |
sync_draft | boolean | Create new PRs/MRs as drafts by default | false |
sync_update_descriptions | boolean | Update PR/MR descriptions on re-sync | true |
sync_update_title | boolean | Update PR/MR titles on re-sync. A GitLab draft keeps its existing prefix if the commit subject has none. | false |
stack_nav_comments | boolean | Post a managed navigation comment on each open PR/MR in a multi-entry stack, listing all entries with a 👉 marker on the current one. When set back to false, the next gg sync removes any previously-posted managed comments. Skipped for single-entry stacks and when --until limits a sync. | false |
worktree_base_path | string | Base directory for managed worktrees | Parent of repo |
github.stacks_integration | off | auto | force | GitHub Stacked PRs public-preview integration. off never inspects or updates it; auto attempts it when the optional gh stack extension and repository support are available; force uses the same safe behavior but reports unavailable capabilities as warnings. Ordinary GitHub sync works without the extension. | auto |
gitlab.auto_merge_on_land | boolean | Default GitLab auto-merge behavior for gg land | false |
Global Config
Store shared defaults in ~/.config/gg/config.json. This is useful for:
- Organization-wide settings (e.g., always use drafts)
- Personal preferences that apply to all your repos
- Reducing repetitive setup across multiple repositories
Example global config:
{
"defaults": {
"sync_draft": true,
"land_auto_clean": true,
"sync_behind_threshold": 5
}
}
When gg setup runs in a new repo, these global defaults will be shown in prompts. You can accept them or override per-repo.
Stack state
git-gud also stores stack-specific state in the local config file (for example PR/MR mappings by GG-ID). This is how it remembers which commit corresponds to which PR/MR over time.
Schema versions
gg versions the state it writes so that mixing binaries never silently drops
data:
.git/gg/config.jsoncarries a top-levelschema_version:2, or3while a remote change is pending (for example a queued branch deletion). A config without one is version1and is upgraded on the next save. gg v0.10.13 and older refuse to rewrite a version-3 config. A queued deletion is cleared when it finishes or proves unnecessary:gg cleanruns the deletionsgg landqueued,gg syncorgg cleanof the stack runs the onesgg dropqueued, andgg reconcile --discard-pendingdrops one you no longer want (the remote branch is then left in place).- Each operation record in
.git/gg/operations/carries its ownschema_version, and each record is written at the lowest version its content needs:2for a single-step command (gg co,gg drop, …), which older releases read and undo normally, and3for a command recorded in several checkpoints (a multi-stepgg sync,gg landorgg clean) or one that records a review retarget or squash-setting change.
The versions change only when an older gg would lose or misread what a newer
one writes, not on every release; patch releases that share a schema work
together freely.
If a file was written by a newer gg than the one you are running, commands
that only read state (gg ls, gg log, gg undo --list,
gg reconcile --dry-run) still work, but any command that would rewrite that
file stops before changing anything, with:
.git/gg/config.json was written by a newer gg (schema 3, this gg supports 2). Upgrade gg to modify this repository.
Upgrade gg (on every machine and tool that shares the repository) before
running mutating commands again. Releases before v0.10.12 do not perform this
check. They list schema-3 records but treat them as not undoable, so a plain
gg undo run by an older release skips a newer multi-step command and reverts
the newest record it does understand.
PR/MR templates
You can customize descriptions by creating .git/gg/pr_template.md.
Supported placeholders:
{{title}}{{description}}{{stack_name}}{{commit_sha}}
Example:
## Summary
{{description}}
---
**Stack:** `{{stack_name}}`
**Commit:** `{{commit_sha}}`