Skip to content

Conversation

@mycarrysun
Copy link
Contributor

@mycarrysun mycarrysun commented Dec 10, 2025

Summary

Fixes #101

The using-git-worktrees skill previously used grep to check only the local .gitignore file, missing patterns in global gitignore configurations (core.excludesfile). This caused unnecessary modifications to local .gitignore when the directory was already globally ignored.

Changed verification from grep to git check-ignore, which respects Git's full ignore hierarchy (local, global, and system gitignore files).

Changes

  • Safety Verification command: grepgit check-ignore -q
  • Updated Quick Reference table, Common Mistakes, Example Workflow, Red Flags, and Always sections for consistency

Testing

Followed TDD process per the writing-skills skill:

  • RED: Baseline test with subagent showed agent would incorrectly conclude directory NOT ignored when using global gitignore, then unnecessarily modify local .gitignore
  • GREEN: After fix, agent correctly uses git check-ignore and recognizes globally-ignored directories
  • REFACTOR: Verified fix works correctly - agent no longer attempts to modify .gitignore when directory is already globally ignored

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated Git worktrees guide to emphasize verifying that directories are ignored (rather than merely listed in .gitignore) before creating worktrees.
    • Guidance and examples now recommend confirming ignore status using the appropriate check command and use "ignored"/"not ignored" phrasing throughout.
    • Minor wording and formatting tweaks to align quick-reference, examples, and red-flag guidance with the new verification approach.

✏️ Tip: You can customize this high-level summary in your review settings.

The using-git-worktrees skill previously used grep to check only the
local .gitignore file, missing patterns in global gitignore configurations
(core.excludesfile). This caused unnecessary modifications to local
.gitignore when the directory was already globally ignored.

Changed verification from grep to git check-ignore, which respects Git's
full ignore hierarchy (local, global, and system gitignore files).

Fixes obra#101

Tested with: Subagent pressure scenarios verifying correct behavior with
global gitignore configuration. Baseline test confirmed the bug, post-fix
test confirmed correct behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Walkthrough

The documentation replaces grep-based .gitignore checks with git check-ignore to verify a directory is ignored (including global ignores), and updates wording throughout to refer to "ignored" status instead of presence in .gitignore; examples and headings adjusted accordingly.

Changes

Cohort / File(s) Summary
Git worktree ignore verification
skills/using-git-worktrees/SKILL.md
Replaced grep-based checks of .gitignore with git check-ignore to verify ignore status; updated terminology from "verify .gitignore" / "in .gitignore" to "verify ignored" / "ignored"; adjusted examples, quick reference, red-flag text, and workflow steps to reflect the new verification approach and minor formatting/heading tweaks.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single documentation file with systematic, repetitive wording and command replacements.
  • No code or behavioral changes; focus review on wording accuracy and command correctness.

Poem

🐰 I sniffed the ignore with gentle cheer,
Grep missed the trail but git drew near.
Now check-ignore shows what I seek—
No local commit, no noisy tweak.
Hop on, worktrees, cozy and clear. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing grep-based verification with git check-ignore for worktree gitignore checks.
Linked Issues check ✅ Passed The PR successfully addresses issue #101 by replacing grep-based verification with git check-ignore to detect globally-ignored directories, preventing unnecessary local .gitignore modifications.
Out of Scope Changes check ✅ Passed All changes are scoped to documentation updates and verification logic for the using-git-worktrees skill, directly addressing the reported bug without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9976a8f and f10acd4.

📒 Files selected for processing (1)
  • skills/using-git-worktrees/SKILL.md (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/using-git-worktrees/SKILL.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5faddc4 and 9976a8f.

📒 Files selected for processing (1)
  • skills/using-git-worktrees/SKILL.md (4 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
skills/using-git-worktrees/SKILL.md

158-158: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🔇 Additional comments (4)
skills/using-git-worktrees/SKILL.md (4)

55-69: ✓ Verification approach correctly updated to respect full gitignore hierarchy.

The switch from grep-based checks to git check-ignore -q properly addresses the bug where globally-ignored directories were incorrectly identified as unignored. The exit code semantics are correct: the command returns 0 if the path is ignored, making the negation with || appropriate for chaining checks of both directory names.

The explanation on line 58 appropriately clarifies the scope improvement. The action sequence (add to .gitignore → commit → proceed) remains correct.


148-152: ✓ Quick Reference table terminology aligned with new verification approach.

The table rows consistently reflect the shift from "in .gitignore" phrasing to "ignored" phrasing, and the action descriptions match the updated verification method.


180-180: ✓ Example workflow step correctly reflects new verification method.

The workflow example on line 180 is updated to show the git check-ignore command output, making it concrete for practitioners following the skill.


193-201: ✓ Red Flags section maintains safety guardrails with updated terminology.

Lines 193 and 201 correctly emphasize the verification requirement with the new terminology ("ignored" rather than "in .gitignore"), ensuring practitioners understand the scope of the safety check includes global and system ignores.

Convert **Title** patterns to ### Title headings for markdown lint
compliance (MD036 - no emphasis as heading).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@yoavsion yoavsion left a comment

Choose a reason for hiding this comment

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

Came to this repo to fork and solve #101, only to find this PR! Thanks for fixing this!
LGTM

@mycarrysun
Copy link
Contributor Author

@obra any reason we can't merge this? I basically have to tell it to stop adding it to my gitignore every worktree I start lol its annoying

@obra obra merged commit c037dcb into obra:main Dec 23, 2025
1 check passed
@mycarrysun mycarrysun deleted the fix-worktree-gitignore-check branch January 2, 2026 17:44
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.

using-git-worktrees tries to gitignore .worktrees even if it is globally ignored

3 participants