Command
build, serve
Description
Git worktrees allow multiple checkouts of the same repository. Each worktree currently gets its own .angular/cache directory with nearly identical contents, since they share the same source tree.
In our project, 4 active frontend worktrees consume ~140 GB of duplicated cache data. This is a significant and unnecessary disk cost.
Nx handles this automatically — when it detects a git worktree, it shares a single cache directory across all worktrees of the same repository.
Describe the solution you'd like
When the CLI detects a git worktree (via .git being a file pointing to a common git directory), resolve the default cache path relative to the common git directory instead of the worktree root. This shares one cache across all worktrees without requiring user configuration.
This is the same approach Nx uses and would make Angular's behavior consistent with Nx for the large number of projects using both together.
Describe alternatives you've considered
- Manually setting
cli.cache.path to a shared absolute path in angular.json — works but requires manual per-project configuration, is easy to forget, and the path is easy to accidentally commit to version control.
Command
build, serve
Description
Git worktrees allow multiple checkouts of the same repository. Each worktree currently gets its own
.angular/cachedirectory with nearly identical contents, since they share the same source tree.In our project, 4 active frontend worktrees consume ~140 GB of duplicated cache data. This is a significant and unnecessary disk cost.
Nx handles this automatically — when it detects a git worktree, it shares a single cache directory across all worktrees of the same repository.
Describe the solution you'd like
When the CLI detects a git worktree (via
.gitbeing a file pointing to a common git directory), resolve the default cache path relative to the common git directory instead of the worktree root. This shares one cache across all worktrees without requiring user configuration.This is the same approach Nx uses and would make Angular's behavior consistent with Nx for the large number of projects using both together.
Describe alternatives you've considered
cli.cache.pathto a shared absolute path inangular.json— works but requires manual per-project configuration, is easy to forget, and the path is easy to accidentally commit to version control.