frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Why You Should Be Using Git Worktrees

https://blog.randombits.host/why-you-should-be-using-git-worktrees/
5•conor_f•3mo ago

Comments

conor_f•3mo ago
Here's a quick blog post I wrote about the merit of git worktrees. Any thoughts or feedback let me know!
fjfaase•3mo ago
Evidence is showing that Continiuos Intergration/Continious Development is the most effective development method. (See dora.dev) Working without branches (on the server) is the best way to implement this. (Search 'ci branches' on YouTube.)
conor_f•3mo ago
A great point. However it's not a reasonable amount of infrastructure or overhead for many companies or an individual project in my opinion!
goku12•3mo ago
> However, since worktrees are actually completely separate directories, you do have to install all your dependencies in each new worktree.

What we need here is package caching in order to reduce download bandwidth and time, and its deduplication to avoid consuming storage space. This is important because worktrees are much more likely to share the same dependencies than unrelated projects. There may be language/toolchain specific solutions for this.

In case of nodejs/frontend projects, both npm and pnpm implement download caching. However, npm seems to copy the relevant modules to the project directory, duplicating the files in storage. Pnpm[1] on the other hand, uses a global cache and symlinks/hardlinks the relevant version of the relevant module to the project tree. This will save a lot of space when multiple worktrees are used.

In the python ecosystem, only conda[2] seems to provide this ability.

The sccache project [3] provides similar advantages to C, C++, Rust and CUDA projects. It caches the binary artifacts of compilation, so that can be used to speed up even first compilation of projects. By default, these caches can be shared between different projects on the same system. But with networked storage backends, sccache can be used to share build artifacts across a network and even enable parallel builds on multiple builds. (Added: Cargo seems to globally cache sources and deal with it on its own without using any links at all.)

Another important detail that might be worth consideration is the filesystem on which the worktrees reside. Copy-on-write filesystems like ZFS, btrfs and bcachefs provide automatic deduplication when copying files within a subvolume. I'm not sure what happens when worktrees are created by git. But they at least have tools to do manual deduplication (btrfs does). Perhaps we can just copy the package manager and build directories (like node_modules and build) from another worktree before running the development tools. Those tools are designed to handle stale cache anyway. So the wrong files wont be much of an issue for them. Perhaps tools like npm should look into making use of such filesystems, because you can get the same advantage as pnpm with practically no extra effort.

[1] https://pnpm.io/motivation#saving-disk-space

[2] https://docs.conda.io/projects/conda/en/latest/user-guide/co...

[3] https://github.com/mozilla/sccache

conor_f•3mo ago
Super interesting, thanks! I didn't think about how this issue could easily point to a major improvement that could be made on the package manager level. Unfortunate that in Python land only Conda supports it though. It looks from the docs that uv may also support it? https://docs.astral.sh/uv/concepts/cache/#cache-directory
goku12•3mo ago
> It looks from the docs that uv may also support it?

I was just repeating what chatgpt told me - that uv does the same thing as npm. The documentation wasn't clear about exactly what it does either. So I had to confirm it using strace. You are indeed correct. UV does hardlink the dependencies from the global cache to the project venv. So that's good!

There's just one caveat. Hardlinking is not possible if the project and the cache are on different file systems. Even btrfs subvolume mounts from a single physical volume is considered as different filesystems. I think pnpm quite happily symlinks it instead of hardlinking it when such a situation arises (I'm not sure though. Need to check that as well.) UV doesn't do that. It complains (prints a warning) and just copies the entire thing over to the venv. So you won't get that advantage with uv if the venv and the cache are on different filesystems (like in my system). I don't know how many developers actually deal with this problem.

Nintendo Wii Themed Portfolio

https://akiraux.vercel.app/
1•s4074433•4m ago•1 comments

"There must be something like the opposite of suicide "

https://post.substack.com/p/there-must-be-something-like-the
1•rbanffy•6m ago•0 comments

Ask HN: Why doesn't Netflix add a “Theater Mode” that recreates the worst parts?

2•amichail•7m ago•0 comments

Show HN: Engineering Perception with Combinatorial Memetics

1•alan_sass•13m ago•1 comments

Show HN: Steam Daily – A Wordle-like daily puzzle game for Steam fans

https://steamdaily.xyz
1•itshellboy•15m ago•0 comments

The Anthropic Hive Mind

https://steve-yegge.medium.com/the-anthropic-hive-mind-d01f768f3d7b
1•spenvo•15m ago•0 comments

Just Started Using AmpCode

https://intelligenttools.co/blog/ampcode-multi-agent-production
1•BojanTomic•16m ago•0 comments

LLM as an Engineer vs. a Founder?

1•dm03514•17m ago•0 comments

Crosstalk inside cells helps pathogens evade drugs, study finds

https://phys.org/news/2026-01-crosstalk-cells-pathogens-evade-drugs.html
2•PaulHoule•18m ago•0 comments

Show HN: Design system generator (mood to CSS in <1 second)

https://huesly.app
1•egeuysall•18m ago•1 comments

Show HN: 26/02/26 – 5 songs in a day

https://playingwith.variousbits.net/saturday
1•dmje•19m ago•0 comments

Toroidal Logit Bias – Reduce LLM hallucinations 40% with no fine-tuning

https://github.com/Paraxiom/topological-coherence
1•slye514•21m ago•1 comments

Top AI models fail at >96% of tasks

https://www.zdnet.com/article/ai-failed-test-on-remote-freelance-jobs/
4•codexon•22m ago•2 comments

The Science of the Perfect Second (2023)

https://harpers.org/archive/2023/04/the-science-of-the-perfect-second/
1•NaOH•23m ago•0 comments

Bob Beck (OpenBSD) on why vi should stay vi (2006)

https://marc.info/?l=openbsd-misc&m=115820462402673&w=2
2•birdculture•26m ago•0 comments

Show HN: a glimpse into the future of eye tracking for multi-agent use

https://github.com/dchrty/glimpsh
1•dochrty•27m ago•0 comments

The Optima-l Situation: A deep dive into the classic humanist sans-serif

https://micahblachman.beehiiv.com/p/the-optima-l-situation
2•subdomain•27m ago•1 comments

Barn Owls Know When to Wait

https://blog.typeobject.com/posts/2026-barn-owls-know-when-to-wait/
1•fintler•28m ago•0 comments

Implementing TCP Echo Server in Rust [video]

https://www.youtube.com/watch?v=qjOBZ_Xzuio
1•sheerluck•28m ago•0 comments

LicGen – Offline License Generator (CLI and Web UI)

1•tejavvo•31m ago•0 comments

Service Degradation in West US Region

https://azure.status.microsoft/en-gb/status?gsid=5616bb85-f380-4a04-85ed-95674eec3d87&utm_source=...
2•_____k•31m ago•0 comments

The Janitor on Mars

https://www.newyorker.com/magazine/1998/10/26/the-janitor-on-mars
1•evo_9•33m ago•0 comments

Bringing Polars to .NET

https://github.com/ErrorLSC/Polars.NET
3•CurtHagenlocher•35m ago•0 comments

Adventures in Guix Packaging

https://nemin.hu/guix-packaging.html
1•todsacerdoti•36m ago•0 comments

Show HN: We had 20 Claude terminals open, so we built Orcha

1•buildingwdavid•36m ago•0 comments

Your Best Thinking Is Wasted on the Wrong Decisions

https://www.iankduncan.com/engineering/2026-02-07-your-best-thinking-is-wasted-on-the-wrong-decis...
1•iand675•36m ago•0 comments

Warcraftcn/UI – UI component library inspired by classic Warcraft III aesthetics

https://www.warcraftcn.com/
2•vyrotek•37m ago•0 comments

Velocity of Money

https://en.wikipedia.org/wiki/Velocity_of_money
1•gurjeet•41m ago•0 comments

Stop building automations. Start running your business

https://www.fluxtopus.com/automate-your-business
1•valboa•45m ago•1 comments

You can't QA your way to the frontier

https://www.scorecard.io/blog/you-cant-qa-your-way-to-the-frontier
1•gk1•47m ago•0 comments