Live data from Hacker News

Rift: Better Alternative to Git Worktrees

github.com

11–20 of 32 posts

Re: Rift: Better Alternative to Git Worktrees

#11
post #2

Neat! Would a similar approach work with ZFS instead of btrfs?

With btrfs, you can freely create subvolumes and snapshots anywhere (including nested inside of each other), you can have thousands of them without any noticeable performance impact, and you can easily convert a snapshot to a writable subvolume. I don't have much experience with ZFS, but from reading another post [0], my impression is that this isn't really doable with ZFS. And based off of rift's Readme, I think tha…

Also you can create and destroy (assuming the 'user_subvol_rm_allowed' mount option) BTRFS subvolumes without being root.

Re: Rift: Better Alternative to Git Worktrees

#12

If that achieves quick COW copies of whole repo and works on Mac OS that's the solution I've been looking for last few weeks. Internets and Claude were insisting that such copies are possible only on Linux via OverlayFS. Seamless switching between unrelated features in the same repo – here I come!

No. XFS too - `cp --reflink=auto`. or LVM / ZFS snapshots if you will

Re: Rift: Better Alternative to Git Worktrees

#13
post #10

Earlier quoted context omitted.

With btrfs, you can freely create subvolumes and snapshots anywhere (including nested inside of each other), you can have thousands of them without any noticeable performance impact, and you can easily convert a snapshot to a writable subvolume. I don't have much experience with ZFS, but from reading another post [0], my impression is that this isn't really doable with ZFS. And based off of rift's Readme, I think tha…

How about cp --reflink? Supported by btrfs, bcachefs and zfs. It's quite not as fast as subvolumes in btrfs, but it should be plenty fast. This should actually be a feature for git itself, if it's not already.

That reflinks the files, which should get you the space savings, but I'm pretty sure that that still has to recursively copy every file in the directory, which can be fairly slow if you have tens of thousands of files, whereas btrfs snapshots can reflink the directory itself, so it should be faster.

Buy yeah, this should be equivalent in most cases, since I can't imagine that many Git repos have enough files for the difference to be noticeable.

Re: Rift: Better Alternative to Git Worktrees

#15
post #10

Earlier quoted context omitted.

How about cp --reflink? Supported by btrfs, bcachefs and zfs. It's quite not as fast as subvolumes in btrfs, but it should be plenty fast. This should actually be a feature for git itself, if it's not already.

That reflinks the files, which should get you the space savings, but I'm pretty sure that that still has to recursively copy every file in the directory, which can be fairly slow if you have tens of thousands of files, whereas btrfs snapshots can reflink the directory itself, so it should be faster. Buy yeah, this should be equivalent in most cases, since I can't imagine that many Git repos have enough files for the…

I don't have a reflink-able filesystem in this host, but I just tested that

    echo 2 | sudo tee /proc/sys/vm/drop_caches
    time cp -rl foo bar
took 2.6 seconds for 273000 files, so I think it's highly manageable. Reflinking might be a bit slower than hardlinking, though.

Re: Rift: Better Alternative to Git Worktrees

#20

Currently it just sounds like an alternative to work trees, but with no explanation on how it’s better. Seems early stages, use of btrfs is cool, but unsure why I’d use this right now

Digging in I now see how btrfs will also copy over non git tracked files, e.g. target/ dir. this is super nice actually.
Post reply on HN