← Back to context

Comment by dv_dt

1 day ago

what is the advantage of git worktree vs using a git remote set to a local file upstream.

As the sibling comments note, this is kind of off-topic to my post.

But I think git worktrees are a bit more ergonomic, I don't have to think about local vs upstream there's just one place to push.

I like to organize my projects like this:

    myproject/.repo/git  # bare repository .. my own convention..
    myproject/main       # worktrees from ../.repo/git
    myproject/feature1
    myproject/feature2

  • The problem I have with worktrees is when I need to switch branches to merge or something. If a work tree for any branch involved exists, git prevents me from switching to it. So, I have to go clone somewhere else, do whatever, then update everything. I really wish git didn't care about the other worktree folders contained, since it clearly doesn't anyways, since you can switch any existing worktree folder to any branch you want.

    So, I no longer use worktrees, and just copy and existing/clone a new folder.

    I think all my problems go away with jujustu.

I'm sure they're roughly equivalent. Parent is probably actually asking: is there native support for managing multiple checkouts/branches for parallel work (and I would add: with lifecycle hooks for create/teardown so I can have dedicated test databases etc).

What is the advantage of a git remote set to a local upstream vs a git worktree?