-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: use git check-ignore for worktree gitignore verification #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
WalkthroughThe documentation replaces grep-based .gitignore checks with Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. Comment |
There was a problem hiding this 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
📒 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 -qproperly 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>
yoavsion
left a comment
There was a problem hiding this 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!
|
@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 |

Summary
Fixes #101
The
using-git-worktreesskill previously usedgrepto check only the local.gitignorefile, missing patterns in global gitignore configurations (core.excludesfile). This caused unnecessary modifications to local.gitignorewhen the directory was already globally ignored.Changed verification from
greptogit check-ignore, which respects Git's full ignore hierarchy (local, global, and system gitignore files).Changes
grep→git check-ignore -qTesting
Followed TDD process per the writing-skills skill:
.gitignoregit check-ignoreand recognizes globally-ignored directories.gitignorewhen directory is already globally ignored🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.