25
you are viewing a single comment's thread
view the rest of the comments
[-] atzanteol@sh.itjust.works 4 points 1 year ago

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.

[-] SpaceNoodle@lemmy.world 1 points 1 year ago

You can already diff between branches in a single worktree.

[-] atzanteol@sh.itjust.works 1 points 1 year ago
[-] SpaceNoodle@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

Then why mention setting up remotes? Why would multiple worktrees help if a worktree is not necessary for the functionality?

[-] atzanteol@sh.itjust.works 2 points 1 year ago

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.

this post was submitted on 31 Jul 2025
25 points (96.3% liked)

General Programming Discussion

10011 readers
1 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 7 years ago
MODERATORS