Skip to content

document git add requirement for untracked files in commit pathspec - #124

Merged
bborbe merged 1 commit into
masterfrom
fix/commit-untracked-pathspec
Aug 23, 2026
Merged

document git add requirement for untracked files in commit pathspec#124
bborbe merged 1 commit into
masterfrom
fix/commit-untracked-pathspec

Conversation

@bborbe

@bborbe bborbe commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Problem

/coding:commit § 2d mandates git commit -m "msg" -- <paths> and warns that git add alone is insufficient. Both true — but a commit pathspec matches only paths git already tracks, so a brand-new file is rejected outright:

error: pathspec 'commands/and.md' did not match any file(s) known to git

The whole commit fails. This hits every commit that introduces a new file, which is most feature work.

Fix

Documents the add-then-pathspec sequence, and explicitly reconciles it with the existing "git add alone is NOT sufficient" line so the two do not read as contradictory. Includes a pre-check that the index holds nothing staged by a sibling session.

Found while committing a rewritten command in bborbe/claude.

A commit pathspec matches only tracked paths, so any commit introducing a
new file failed outright with 'did not match any file(s) known to git'.
Adds the add-then-pathspec sequence and reconciles it with the existing
'git add alone is NOT sufficient' line.

@ben-s-pull-request-reviewer ben-s-pull-request-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff is small and purely documentation: CHANGELOG.md (4 lines added) and commands/commit.md (11 lines added). The mechanical funnel confirmed 0 findings. This is a docs-only change — no code, no security-sensitive content, no toolchain needed.

Reviewing the changes:

  • CHANGELOG.md — Unreleased entry correctly formatted, describes the bug fix.
  • commands/commit.md — New section documents a real git behavior: a commit pathspec only matches tracked files, so untracked (new) files must be git add-ed first. The sequence example is correct and includes a pre-flight git diff --cached --name-only check to avoid sibling-session collisions.

No issues found. The documentation accurately describes git behavior and the changelog follows the project's format.

{
  "verdict": "approve",
  "summary": "Docs-only change adding a CHANGELOG entry and documenting the requirement to git add untracked files before using a pathspec in git commit. Accurate, well-formed, no concerns.",
  "comments": [],
  "concerns_addressed": []
}

@bborbe
bborbe merged commit 8c3b328 into master Aug 23, 2026
1 check passed
@bborbe
bborbe deleted the fix/commit-untracked-pathspec branch August 23, 2026 21:16
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