Skip to content

chore(git): add a trimmed git config for Claude Code sessions - #51

Merged
potsrevennil merged 2 commits into
mainfrom
chore/agent-git-output
Oct 20, 2026
Merged

potsrevennil merged 2 commits into
mainfrom
chore/agent-git-output

Conversation

@potsrevennil

@potsrevennil potsrevennil commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Agents run git dozens of times per session, and git's defaults are written for people: hint paragraphs and long-form status. In a scratch repo, git status goes from 7 lines to 2, git init from 14 to 1, and an unmerged git branch -d from 3 to 1.

users/home/git/agent.gitconfig includes the normal config (identity, editor, commit template), then turns on short status and turns off hint text. home-manager links a Nix store copy to ~/.config/git-agent/config, and Claude Code will select it through GIT_CONFIG_GLOBAL in its settings env, so interactive git is unchanged. Config only trims status and hints. The larger savings (log, show, diff) come from command choice, which will be instructions in ~/.claude/CLAUDE.md, outside this repo.

  • Look at: why it's a store copy and not out-of-store like ~/.config/git. If GIT_CONFIG_GLOBAL names a missing file, git silently drops the whole global config and agents lose user.email. An out-of-store link would disappear whenever the main checkout is on a branch without the file. The store copy also makes an agent's git config --global fail instead of editing a tracked file. The cost is that edits need make home.
  • Not overridden on purpose: pager, color and delta. Agents' output is never a TTY, so git already skips them.
  • Verify:
    GIT_CONFIG_GLOBAL=$PWD/users/home/git/agent.gitconfig git status
    GIT_CONFIG_GLOBAL=$PWD/users/home/git/agent.gitconfig git config user.email
    nix eval --raw '.#homeConfigurations.thing-hanlim.config.xdg.configFile."git-agent/config".source'
  • Out of scope: after merge and make home, two hand edits: "env": {"GIT_CONFIG_GLOBAL": "/Users/thing-hanlim/.config/git-agent/config"} in ~/.claude/settings.json, and the agent git rules in ~/.claude/CLAUDE.md. Also out: output proxies such as rtk, and gh output.

🤖 Generated with Claude Code

potsrevennil and others added 2 commits October 20, 2026 13:44
Agents run git dozens of times per session, and git's defaults are
written for people. users/home/git/agent.gitconfig includes the normal
config and turns on short status, and turns off hint text, the pager
and color. Claude Code is to select it via GIT_CONFIG_GLOBAL in its
settings env, so interactive git is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Link a Nix store copy to ~/.config/git-agent/config, so it exists
  whatever branch the main checkout is on (a missing GIT_CONFIG_GLOBAL
  silently drops the whole global config, identity included) and an
  agent's `git config --global` fails instead of editing this file.
- Include ~/.gitconfig too: GIT_CONFIG_GLOBAL replaces both global files.
- Silence push-rejected, set-upstream, force-delete-branch and
  default-branch-name hints.
- Drop the pager and color overrides: agents' output is never a TTY, so
  they changed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@potsrevennil
potsrevennil marked this pull request as ready for review October 20, 2026 05:52
@potsrevennil
potsrevennil merged commit e2737e7 into main Oct 20, 2026
7 checks passed
@potsrevennil
potsrevennil deleted the chore/agent-git-output branch October 20, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant