Problem
When working with multiple worktrees, developers often need to sync configuration files (especially .env files) from the main repo to worktrees after they've been created.
Current workflow requires manual commands:
cd /path/to/main-repo && find . -name ".env*" -type f -exec sh -c \
'mkdir -p "/path/to/worktree/$(dirname "$1")" && cp "$1" "/path/to/worktree/$1"' _ {} \;
This is verbose, error-prone, and breaks the DX that gtr provides.
Proposed Solution
Add a git gtr copy command:
git gtr copy 1 my-feature --pattern ".env*"
This would copy all matching files from the main repo to the worktree while preserving directory structure.
Use Cases
- Created a worktree with
--no-copy but now need env files
- Updated
.env in main and need to propagate to existing worktrees
- Selective sync without running full
postCreate hooks
Problem
When working with multiple worktrees, developers often need to sync configuration files (especially
.envfiles) from the main repo to worktrees after they've been created.Current workflow requires manual commands:
This is verbose, error-prone, and breaks the DX that
gtrprovides.Proposed Solution
Add a
git gtr copycommand:git gtr copy 1 my-feature --pattern ".env*"This would copy all matching files from the main repo to the worktree while preserving directory structure.
Use Cases
--no-copybut now need env files.envin main and need to propagate to existing worktreespostCreatehooks