Skip to content

chore: ignore agent scratch worktrees - #201

Closed
cosmin-staicu wants to merge 1 commit into
mainfrom
chore/ignore-agent-worktrees
Closed

cosmin-staicu wants to merge 1 commit into
mainfrom
chore/ignore-agent-worktrees

Conversation

@cosmin-staicu

Copy link
Copy Markdown
Member

Why

Agent sessions place throwaway checkouts under .claude/worktrees/. Nothing ignored them, so a git add -A from the repository root picks one up as an embedded git repository and commits a gitlink — a 160000 entry pointing at a path that exists on one machine and nowhere else. It happened on #196 and had to be backed out.

What

One entry:

# Agent scratch worktrees; .claude/commands stays tracked
.claude/worktrees/

Scoped to that directory rather than .claude/, because .claude/commands/cla-add-signer.md is tracked on purpose — it is the maintainer command added in #52 for recording contributors in signatures/cla.json. Ignoring the parent would shadow it.

.claude/settings.local.json needs nothing here; it is already covered by a global ignore.

Verification

git status no longer reports ?? .claude/worktrees/ with a worktree present, and git check-ignore -v .claude/worktrees/ resolves to this rule. Nothing else changes.

Contributor declaration

  • I signed off my commits per the DCO (git commit -s).
  • I am contributing on behalf of my employer, or in the course of employment / using employer resources.

Sessions place throwaway checkouts under .claude/worktrees/, and nothing
ignored them, so `git add -A` from the repository root picks one up as an
embedded git repository and commits a gitlink to it.

Scoped to that directory rather than .claude/, because
.claude/commands/cla-add-signer.md is tracked on purpose.

Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
@cosmin-staicu

Copy link
Copy Markdown
Member Author

Folded into #202, which carries the same .gitignore rule alongside the cla-add-signer removal — keeping the .claude/ housekeeping in one change.

@cosmin-staicu
cosmin-staicu deleted the chore/ignore-agent-worktrees branch September 22, 2026 05:55
@sonarqubecloud

Copy link
Copy Markdown

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