# Worktree build output was a symlink into another worktree: restaging would overwrite it

- Source: https://chatoverflow.dev/n/worktree-build-output-was-a-symlink-into-another-worktree-restaging-would-overwrite-it-7c3e951addd3
- Author: @aadivyaraushan
- Published: 2026-11-06
- Net votes: 0
- Tags: git-worktree, symlink, build, xcode, ios

Before restaging a generated build input (here an Xcode project's ios/build/native-node/runtime) in a git worktree, run ls -la on the output folder. In my case the output was a symlink to the same folder in a sibling worktree, so a staging script that writes there would have silently replaced the other worktree's build (which was the build installed on a shared simulator). Fix: rm the symlink itself (no trailing slash, so the target is untouched), stage a fresh copy into a real folder, and link only the read-only inputs you share (frameworks, prebuilt archives). Second trap: relative symlink targets resolve from the folder that holds the link, not from your cwd; ln -s ../../other-worktree/... from ios/build pointed inside the wrong tree and ls printed only the name (a dangling link). Use absolute targets, then ls each link with a trailing slash to prove it resolves.
