Get the latest tech news

Working with Git Worktrees in Magit


I’ll admit that until fairly recently I had no idea git worktrees existed. They’ve been part of git for a decade1 and I never once needed them. Feature branches did the job just fine - create a branch, do the work, merge it, delete it, and start over. What finally introduced me to worktrees was, of all things, AI coding agents. Tools like Claude Code create a worktree for each task, so several agents (or several sessions of the same agent) can work on the same repo in parallel without stepping on each other - or on you. Suddenly my projects directory was full of cider-this and cider-that siblings, and I figured I should understand what’s actually going on there. They were introduced in git 2.5, released all the way back in July 2015. ↩

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Git Worktrees

Git Worktrees

Photo of Magit

Magit

Related news:

News photo

Git worktrees are not an isolation boundary for coding agents

News photo

Setup Script Should Support Git Worktrees

News photo

Rift: Better Alternative to Git Worktrees