Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

git-gud uses a layered configuration system:

  1. Global config: ~/.config/gg/config.json — shared defaults across all repos
  2. 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

OptionTypeWhat it controlsDefault
providerstringProvider (github/gitlab) for self-hosted or explicit overrideAuto-detected
basestringDefault base branch for new stacksAuto-detected
branch_usernamestringUsername prefix in stack/entry branch namesAuto-detected
lintstring[]Commands used by gg lint / gg sync --lint[]
auto_add_gg_idsbooleanDeprecated compatibility field. gg always enforces GG metadata normalization, regardless of this value.true
unstaged_actionstringDefault behavior for gg sc/gg amend when unstaged changes exist: ask, add, stash, continue, or abortask
land_wait_timeout_minutesnumberTimeout for gg land --wait polling30
land_adminbooleanUse admin privileges to bypass approval requirements on land (GitHub only)false
land_auto_cleanbooleanAuto-run cleanup after full landingfalse
sync_auto_lintbooleanAutomatically run gg lint before gg syncfalse
sync_auto_rebasebooleanAutomatically run gg rebase before gg sync when behind threshold is reachedfalse
sync_behind_thresholdnumberWarn/rebase in gg sync when base is at least this many commits behind origin/<base> (0 disables check)1
sync_draftbooleanCreate new PRs/MRs as drafts by defaultfalse
sync_update_descriptionsbooleanUpdate PR/MR descriptions on re-synctrue
sync_update_titlebooleanUpdate PR/MR titles on re-sync. A GitLab draft keeps its existing prefix if the commit subject has none.false
stack_nav_commentsbooleanPost 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_pathstringBase directory for managed worktreesParent of repo
github.stacks_integrationoff | auto | forceGitHub 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_landbooleanDefault GitLab auto-merge behavior for gg landfalse

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.json carries a top-level schema_version: 2, or 3 while a remote change is pending (for example a queued branch deletion). A config without one is version 1 and 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 clean runs the deletions gg land queued, gg sync or gg clean of the stack runs the ones gg drop queued, and gg reconcile --discard-pending drops one you no longer want (the remote branch is then left in place).
  • Each operation record in .git/gg/operations/ carries its own schema_version, and each record is written at the lowest version its content needs: 2 for a single-step command (gg co, gg drop, …), which older releases read and undo normally, and 3 for a command recorded in several checkpoints (a multi-step gg sync, gg land or gg 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}}`