Skip to content

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

Closed

Description

@technicalpickles

Describe the bug
When using the using-git-worktrees skill, I've found it useful to add a global gitignore for .worktrees so I don't have to update every project's gitignore. Even though I have this, the skill tries to add it to the local gitignore and commit it

The .worktrees/ directory needs to be added to .gitignore first to prevent accidentally committing worktree contents.

To Reproduce
Steps to reproduce the behavior:

  1. Configure global gitignore
[core]
    excludesfile = ~/.gitignore
  1. Add .worktrees/ to ~/.gitignore
  2. Activate using-git-worktrees and chose .worktrees
  3. See agent point out needing to gitignore it

Expected behavior

I'd expect the skill to notice it is already gitignored before trying to do it. There is git check-ignore for example:

❯ git check-ignore -v .worktrees/
/Users/josh.nichols/.gitignore:10:.worktrees/   .worktrees/

Logs

Agent (claude-sonnet-4-5-20250929)

I'm using the using-git-worktrees skill to set up an isolated workspace for implementing the rv backend.

Agent (claude-sonnet-4-5-20250929)

Tool use: Bash Check for existing worktree directories

ls -d .worktrees 2>/dev/null || ls -d worktrees 2>/dev/null || echo "NONE"

Result:

NONE

Agent (claude-sonnet-4-5-20250929)

Tool use: Bash Check CLAUDE.md for worktree preference

grep -i "worktree.*director" CLAUDE.md 2>/dev/null || echo "NO_PREFERENCE"

Result:

NO_PREFERENCE

Agent (claude-sonnet-4-5-20250929)

No worktree directory found. Where should I create worktrees?

  1. .worktrees/ (project-local, hidden)
  2. ~/.config/superpowers/worktrees/mise/ (global location)

Which would you prefer?


User

.worktrees


Agent (claude-sonnet-4-5-20250929)

Perfect! I'll use .worktrees/ for the isolated workspace.

Agent (claude-sonnet-4-5-20250929)

Tool use: Bash Check if .worktrees/ is in .gitignore

grep -q "^\.worktrees/$" .gitignore && echo "FOUND" || echo "NOT_FOUND"

Result:

NOT_FOUND

Agent (claude-sonnet-4-5-20250929)

The .worktrees/ directory needs to be added to .gitignore first to prevent accidentally committing worktree contents.

Agent (claude-sonnet-4-5-20250929)

Tool use: Read ./.gitignore

Result:

1→.DS_Store
     2→/dist/
     3→/node_modules/
     4→package-lock.json
     5→.mise.lock
     6→/mise.local.toml
     7→/perf-workspace
     8→
     9→*.log
    10→*.profraw
    11→*.lcov
    12→flamegraph.svg
    13→cargo-flamegraph.trace
    14→
    15→**/snapshots/*.snap.new
    16→
    17→# Generated by Cargo
    18→# will have compiled files and executables
    19→/target
    20→# These are backup files generated by rustfmt
    21→**/*.rs.bk
    22→
    23→# Snapcraft
    24→*.snap
    25→
    26→# alpine
    27→.ash_history
    28→.abuild
    29→/aports
    30→
    31→megalinter-reports/
    32→.dev/
    33→
    34→.vscode/
    35→testResults.xml
    36→.mise/
    37→comment.md
    38→
    39→.claude/settings.local.json
    40→

Agent (claude-sonnet-4-5-20250929)

Tool use: Edit

Result:

The file /Users/josh.nichols/workspace/mise/.gitignore has been updated. Here's the result of running `cat -n` on a snippet of the edited file:
    35→testResults.xml
    36→.mise/
    37→comment.md
    38→
    39→.claude/settings.local.json
    40→
    41→.worktrees/
    42→

Agent (claude-sonnet-4-5-20250929)

Tool use: Bash Commit .gitignore change

git add .gitignore && git commit -m "chore: add .worktrees/ to .gitignore"

Error:

The user doesn't want to proceed with this tool use. The tool use was rejected (eg. if it was a file edit, the new_string was NOT written to the file). The user provided the following reason for the rejection:  it's globally i

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    on Nov 10, 2025
  2. added a commit that references this issue on Dec 10, 2025
    9976a8f
  3. mycarrysun commented on Dec 10, 2025

    @mycarrysun
    Contributor

    I just added a PR that should fix this by using git check-ignore rather than relying on any certain file path

  4. added a commit that references this issue on Dec 23, 2025
    c037dcb
  5. added a commit that references this issue on Jan 30, 2026
    0e904b5
  6. added 2 commits that reference this issue on Feb 19, 2026
    565077a
    49c0955
  7. added a commit that references this issue on Mar 6, 2026
    1306094
  8. added a commit that references this issue on Mar 25, 2026
    4598091
  9. added a commit that references this issue on Apr 6, 2026
    603e38b
  10. added a commit that references this issue on Aug 16, 2026
    faa651b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions