
31·
17 days agoThe question I was answering was about worktrees vs. multiple clones. With multiple clones you need to setup remotes to share branches between directories. With worktrees sharing a working copy you don’t.
The question I was answering was about worktrees vs. multiple clones. With multiple clones you need to setup remotes to share branches between directories. With worktrees sharing a working copy you don’t.
Yes, that’s what I said.
As somebody who rarely has a “pristine” working copy I love worktrees. I usually have a “project-master” worktree that’s a pristine checkout of the master
branch so I can test builds and things without interference from uncommitted and temporary files.
It’s more space efficient - you don’t get another full copy of the repo. The worktree points back to the same .git directory.
And since it’s in the same repo you can diff between branches with other worktrees without needing to setup remotes for each of them.
When you do that you can’t compare branches in the same working copy in different directories. You need to create remotes between the two working copies and push/pull between them.
e.g. “git log --graph …my-branch” or “git diff my-branch master” where my-branch and master are in different directories.