3 ms·
Duplicate storage as already mentioned, but you will also lose the ability to merge / doff cross branches if you have separate checkouts.
by halfdan 5y ago
Duplicate storage as already mentioned, but you will also lose the ability to merge / doff cross branches if you have separate checkouts.
- cortesoft 5y agoWhy would you lose that ability? You can just pull from the other checkout as an upstream, right?
- jonathanlydall 5y agoWorktree allows you to checkout other branches, stashes or commits which are local only / not yet pushed. What’s also great is that you don’t need to do a pull in the other folder. Before I discovered worktree, I had my repository checked out in two places, so was either pulling both constantly, or when I needed the alternate, it was often very far behind and I had to pull a lot.
- CorrectHorseBat 5y agoHmm, I tried it once and iirc I couldn't see commits/branches of the other workspace without pushing and fetching so I really didn't see any difference. With different checkouts you can also easily do that by adding the other checkout as a remote.
- dataflow 5y agoSomething probably got messed up on your setup (or maybe you checked out a commit instead of a branch?) because you definitely can see all worktrees' branches from inside each other when using git worktree.
- CorrectHorseBat 5y agoThat makes sense. Now I think about it, The issue probably was that I was working in a submodule and those branches are probably not shared.
- jonathanlydall 5y agoYes, as per my other comment, I’ve noticed with submodules that the references are isolated between the different folders, but they do share the same objects in the .git folder, so you still get efficiency there in not needing to store or pull duplicate data.
- jonathanlydall 5y agoNot sure what you were doing wrong, but I use worktree regularly and you can absolutely see the same commits from both the primary and worktree side. The great thing about worktrees is that everything local is still available in the worktree and vice-versa, you can even stash push on the one side and pop on the other. You also don’t need to push or pull on either side first. I have noticed that for submodules, although they share the .git folder, they don’t share references, so you can’t see local branches and stashes between the worktrees, but sub module pulls are still quicker since they share objects so those don’t need re-pulled on the other folder.