Repository navigation
chore(git): add a trimmed git config for Claude Code sessions - #51
Merged
Merged
Conversation
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
marked this pull request as ready for review
October 20, 2026 05:52
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 statusgoes from 7 lines to 2,git initfrom 14 to 1, and an unmergedgit branch -dfrom 3 to 1.users/home/git/agent.gitconfigincludes 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 throughGIT_CONFIG_GLOBALin its settingsenv, so interactive git is unchanged. Config only trimsstatusand hints. The larger savings (log, show, diff) come from command choice, which will be instructions in~/.claude/CLAUDE.md, outside this repo.~/.config/git. IfGIT_CONFIG_GLOBALnames a missing file, git silently drops the whole global config and agents loseuser.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'sgit config --globalfail instead of editing a tracked file. The cost is that edits needmake home.GIT_CONFIG_GLOBAL=$PWD/users/home/git/agent.gitconfig git statusGIT_CONFIG_GLOBAL=$PWD/users/home/git/agent.gitconfig git config user.emailmake 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 asrtk, andghoutput.🤖 Generated with Claude Code