2 ms·
You can also have multiple independent git repos that don't duplicate the full object store, via git clone --reference. It's less relevant in the container era,
by nasretdinov 5mo ago
You can also have multiple independent git repos that don't duplicate the full object store, via git clone --reference. It's less relevant in the container era, but otherwise it can save a lot of time and disk space when cloning repos repeatedly
- packetlost 5mo agoOh, that's actually really useful for my... inefficient clone of nixpkgs and the linux kernel...
- yjftsjthsd-h 5mo agoInteresting; how's it compare to work trees?
- nasretdinov 5mo agoWorktrees are different checkouts of the same repo. Clone with --reference is a separate repo altogether, with its own .git and worktree.
- cerved 5mo agoWorktrees effectively share the entire state of the repo. Only limitation is that a branch can only be checked out in one repo at a time. Clones only share the immutable object store For most practical uses of same repo checking out different branches locally, worktrees are better. The nice thing about clones is that you can have a backup clone, a wip clone, a review clone where you don't clutter the amount of local branch refs
- cerved 5mo agoofc if you're running AI agents in YOLO mode — clones means you don't need to worry that Sonnet is going to see your .git/index.lock file and go "this is blocking me, let's rm -f this" and corrupt all your work that you never bothered pushing