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 -A over a shared checkout can capture peer edits.
  • Commit authorship and committer identity are distinct. The machine's git codex alias expands to commit with an explicit --author identity for Codex; the configured Git user remains the committer.
  • CodeGraph is the project's first code-navigation path; the gkg guide is background for an explicitly requested GKG workflow, subject to tool availability.

examples

git status --short
git add -- path/to/owned-file
git diff --cached --check
git diff --cached --stat
git 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 git guide for the longer history workflow.
  • Keep commit and PR text free of Co-authored-by and generated-by attribution. For multiline PR text, use gh pr create --body-file; the flag is documented by GitHub CLI.
  • Use worktree read-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; invoke git codex -m ..., not git 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 -A on a shared checkout can include unrelated changed files, because it stages every path. Stage owned pathspecs instead and inspect git diff --cached before the commit.

practiced cases

  • With Apple Git 2.50.1, git config --get alias.codex returns commit with the Codex --author identity; that establishes the correct invocation without making a commit.
  • On Node 24.14.1, the worktree script's info --json and create audit-path --dry-run --json exit 0 with parseable JSON. Worktree creation and cleanup are untested here.

Read the git guide.

search pages

go to any page