4 ms·
I tried that, and discovered that it won't let you have two worktrees with the same branch checked out?
by pjc50 6y ago
I tried that, and discovered that it won't let you have two worktrees with the same branch checked out?
- hiq 6y agoOfftopic (I think), but I just learned that "For instance, git worktree add -d <path> creates a new working tree with a detached HEAD at the same commit as the current branch." (from the manpage). It's offtopic because the second worktree has a detached HEAD, so that doesn't help in the case you mention.
- ivanbakel 6y agoWhich is very sane - what should git do if you modify the branch in one tree but not in the other? The least painful solution would require something like multiple-refs-per-remote-branch, which would be (to my understanding) a re-architecture.
- pjc50 6y agoWell, I wanted the same effect as two separate checkouts (ie entirely separate branch structures) but with a bit of the disk space shared between them, but that's not how it works.
- alblue 6y agoYou can use “git clone” for that; it will set up an alternates link in the local clone, so you only store the git object data in the origin but apply deltas to the clone.