What is the reason behind not hiding git worktrees from git?
- From
- Jakub T. Jankiewicz <jcubic@jcubic.pl>
- Date
- Sep 27, 2025, 13:28 UTC
- Message-ID
- <20250927152824.3132af88@jcubic>
Hi,
I use git since 2010, but I've discovered git work trees recently.
Why git work trees are are not automatically ignored by git?
It would kind if silly to add the whole project on different branch to the main repo.
This is an example:
git worktree add base git status
On branch master Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
base/nothing added to commit but untracked files present (use "git add" to track)
What is the rationale for this. Why base/ is not automatically ignored and you need to add it to the .gitignore by hand?
I use git 2.51.0 from Fedora default repo.
-- Jakub T. Jankiewicz, Senior Front-End Developer https://jakub.jankiewicz.org https://lips.js.org https://koduj.org