From 5656407fa7a7235e70f1ae6f4c0b694b47bb0c6c Mon Sep 17 00:00:00 2001 From: David Poblador i Garcia Date: Tue, 10 Feb 2026 15:10:29 +0100 Subject: [PATCH] feat: symlink .env into new worktrees When wt-add creates a worktree, it now checks for a .env file at the project root and creates a symlink to it inside the new worktree. Removal is safe by default: git worktree remove deletes the symlink without touching the target file, since .env is gitignored. Co-Authored-By: Claude Opus 4.6 --- template/justfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/template/justfile b/template/justfile index b15b2a9..92cff52 100644 --- a/template/justfile +++ b/template/justfile @@ -42,6 +42,12 @@ wt-add branch base='main': git worktree add -b "$BRANCH" "$BRANCH" "$BASE" echo "Created new branch '$BRANCH' from '$BASE'" fi + # Symlink .env from project root into the worktree if available + if [ -f .env ] && [ ! -e "$BRANCH/.env" ]; then + ln -s "$(pwd)/.env" "$BRANCH/.env" + echo "Linked .env into worktree" + fi + echo " cd $BRANCH/" # Remove a git worktree and its local branch (accepts branch name or folder path)