For example, I have /tmp/foo Git repository, etc branch and non-empty /etc directory. I wish to attach the /etc directory as a worktree to the etc branch. git worktree add /etc etc won't work due to "already exists".
I saw some old discussion in between Git developers but not sure was this case/issue solved nowadays.
I understand that I can exec something like the following:
git worktree add /tmp/bar etc- Rename
/tmp/foo/.git/worktrees/barto/tmp/foo/.git/worktrees/etc - Edit
/tmp/foo/.git/worktrees/etc/gitdir - Create proper
/etc/.gitfile which pointing to/tmp/foo/.git/worktrees/etc
But I am wondering is there some more handy way to do that in the modern Git?