Skip to content

chore: gitignore .claude/worktrees/ - #12

Merged
HRLoveFun merged 1 commit into
mainfrom
worktree-gitignore-claude-worktrees
Sep 11, 2026
Merged

HRLoveFun merged 1 commit into
mainfrom
worktree-gitignore-claude-worktrees

Conversation

@HRLoveFun

Copy link
Copy Markdown
Owner

起因

.claude/worktrees/<name>(Claude Code EnterWorktree 工具的每任务 worktree)此前没有被 .gitignore 排除。这类目录本身也是独立的 git 仓库,主仓库里对它执行 git add -A 之类的操作会把它当作 gitlink(mode 160000)提交进去——本地 main 分支上已经因此出现过两次意外提交(一次还夹带了一个从未同步过的 AGENTS.md),均在推送前发现并丢弃。

改动

.gitignore 新增 .claude/worktrees/,与已有的 .worktrees/(ADR 0009,项目自带的按任务 worktree)区分开、并列排除。

验证

  • pre-commit(doc-guard / regen-adr-index / audit-tags)通过(无匹配文件,全部 skip,符合预期——纯 .gitignore 改动)。

🤖 Generated with Claude Code

…ain as gitlinks

.claude/worktrees/<name> (created by the Claude Code EnterWorktree tool) was not
excluded, so a git add -A in the main checkout twice added these nested
checkouts as gitlink entries (mode 160000) on local main, plus once dragged in
an unrelated stray AGENTS.md. Neither commit was ever pushed; both were reset
away. Ignoring the directory outright stops it recurring.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@HRLoveFun
HRLoveFun merged commit 6dba861 into main Sep 11, 2026
2 of 3 checks passed
@HRLoveFun
HRLoveFun deleted the worktree-gitignore-claude-worktrees branch September 11, 2026 01:36
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