git trained
the learned layer for the git guru: the mental model, the practices, and the measured cases.
mental model
- The index is an exact proposal for the next commit. Review it after staging owned paths;
git add -Aover a shared checkout can capture peer edits. - Commit authorship and committer identity are distinct. The machine's
git codexalias expands tocommitwith an explicit--authoridentity for Codex; the configured Git user remains the committer. - CodeGraph is the project's first code-navigation path; the
gkgguide is background for an explicitly requested GKG workflow, subject to tool availability.
examples
git status --shortgit add -- path/to/owned-filegit diff --cached --checkgit diff --cached --statgit codex -m "fix(scope): describe the change"
git add -- <path> stages only the named path; Git documents pathspec staging and index semantics in git-add. The alias expansion above comes from this machine's Git configuration.
best practices
- Reread live status before staging and before claiming a clean result. Stage only task-owned paths; inspect the staged diff for secrets and unrelated content. Use the
gitguide for the longer history workflow. - Keep commit and PR text free of
Co-authored-byand generated-by attribution. For multiline PR text, usegh pr create --body-file; the flag is documented by GitHub CLI. - Use
worktreeread-only for inspection. The global instructions require explicit authority before creation, removal, pruning, branch changes, history rewriting, or force-push.
strengths
- A scoped staged diff makes ownership and commit content reviewable before history changes.
- CodeGraph can expose symbols and call paths when the repo has an index.
weaknesses / pain points
- A shared checkout requires path-level staging and a fresh ownership check; generic Git tutorials often assume one writer.
- A detached or absent CodeGraph index prevents graph-backed conclusions; fall back to source inspection and state that boundary.
gotchas
- The local alias already contains
commit; invokegit codex -m ..., notgit codex commit -m .... - The worktree guide points at its local script, but creating, removing, or pruning worktrees still needs explicit authority.
- Pushing, PR creation, and merge have different external effects; do not infer one authorization from another.
known bugs
No version-specific Git, GitHub CLI, CodeGraph, or worktree-script defect is confirmed here. Do not turn an upstream example into a bug claim without a reproducer and issue link.
troubleshooting
git add -Aon a shared checkout can include unrelated changed files, because it stages every path. Stage owned pathspecs instead and inspectgit diff --cachedbefore the commit.
practiced cases
- With Apple Git 2.50.1,
git config --get alias.codexreturnscommitwith the Codex--authoridentity; that establishes the correct invocation without making a commit. - On Node 24.14.1, the worktree script's
info --jsonandcreate audit-path --dry-run --jsonexit 0 with parseable JSON. Worktree creation and cleanup are untested here.
Read the git guide.