Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

git worktree.

Godsend if you regularly need to work on multiple branches simultaneously.



“Let me share the Good News of git worktrees” is a thing I say often in our work Slack.


What does worktree provide that a fresh local clone doesn't?


Reduced disk space usage for large repositories. And a convenient way to manage all your clones


I guess it reduces duplicating the history? Large files are by far the bulk of what I personally deal with so it don't think there's a real difference for me but I could see it helping.


Yeah, it only stores the objects in the .git directory once.


Maybe too obvious, but if you’re not pushing everything to the remote, local-only content is available in both worktrees.


If it's a multi-gigabyte repo that you are cloning over a slow VPN, it speeds things up quite a bit.


The `--reference` and `--dissociate` flags to `git clone` can be used to avoid the majority of the network transfer while still creating an independent local repository.


Like I said, I'd usually just clone locally, as in clone from the repo you already have on disk.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: