Dessalines@lemmy.ml to General Programming Discussion@lemmy.ml · 1 month agoWorktrees: Git's best kept secret (and why you should use them) | Tom Upswww.tomups.comexternal-linkmessage-square20linkfedilinkarrow-up125arrow-down11
arrow-up124arrow-down1external-linkWorktrees: Git's best kept secret (and why you should use them) | Tom Upswww.tomups.comDessalines@lemmy.ml to General Programming Discussion@lemmy.ml · 1 month agomessage-square20linkfedilink
minus-squareatzanteol@sh.itjust.workslinkfedilinkEnglisharrow-up4·1 month agoIt’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.
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up1·1 month agoYou can already diff between branches in a single worktree.
minus-squareatzanteol@sh.itjust.workslinkfedilinkEnglisharrow-up2arrow-down1·1 month agoYes, that’s what I said.
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up1·edit-21 month agoThen why mention setting up remotes?
minus-squareatzanteol@sh.itjust.workslinkfedilinkEnglisharrow-up3arrow-down1·1 month 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.
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.
You can already diff between branches in a single worktree.
Yes, that’s what I said.
Then why mention setting up remotes?
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.