Skip to content

feat: add wt.nogitignore and wt.noreadme config options#162

Open
Nymphium wants to merge 2 commits intok1LoW:mainfrom
Nymphium:main
Open

feat: add wt.nogitignore and wt.noreadme config options#162
Nymphium wants to merge 2 commits intok1LoW:mainfrom
Nymphium:main

Conversation

@Nymphium
Copy link

Summary

  • Add wt.nogitignore and wt.noreadme git config options to skip creating .gitignore and README.md in the worktree base directory
  • Refactor AddWorktree/AddWorktreeWithNewBranch to accept Config instead of CopyOptions (which was a redundant subset of Config)

Motivation

.gitignore and README.md creation in the base directory was introduced by #81. When placing worktrees in a subdirectory (e.g., .worktrees/) that is already ignored by a global gitignore (~/.config/git/ignore), the .gitignore created by git-wt (which contains *) can cause problems with certain tools.

For example, oxlint (which uses the ignore crate in Rust) traverses parent directories looking for .gitignorefiles and applies them — so the*` pattern ends up ignoring all files from the tool's perspective.

These new config options allow users to opt out of creating these files. The default behavior does not change.

Since AddWorktree/AddWorktreeWithNewBranch now need Config for the new flags, CopyOptions (which was just a subset of Config, built rom it at every call site) was removed from their signatures. CopyOptions is now constructed internally in copyAfterAdd.

Nymphium and others added 2 commits March 24, 2026 16:45
Allow users to disable automatic creation of .gitignore and README.md in the worktree base directory via git config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CopyOptions was a subset of Config, built from Config at every call site. Pass Config directly and construct CopyOptions internally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant