00:00:00Claude Code has received an insane amount
00:00:02of updates recently from Claude Desktop's SSH support,
00:00:05app previews, and to GitHub integration
00:00:07to simple mode in the terminal,
00:00:09which strips out skills, plugins, and custom tools,
00:00:11making it easy for basic tasks.
00:00:13But the biggest update by far is native work tree support,
00:00:16meaning your agents can work on multiple features
00:00:18or bug fixes in isolation
00:00:20without you having to manually configure anything.
00:00:23But was this released too soon,
00:00:25with many developers already having basic issues?
00:00:28Hit subscribe, and let's get into it.
00:00:30Using Git's work trees with coding agents is nothing new.
00:00:33In fact, Claude Desktop has had it for a while,
00:00:35and there are many plugins or tools that support it,
00:00:37like Claude Squad, which we've already made a video about.
00:00:41But one of the reasons I personally haven't done it
00:00:43is because doing it manually can add mental load,
00:00:46and hopefully this new feature in Claude Code
00:00:49will make it a lot easier for me.
00:00:50Let's try it.
00:00:51So here is a basic to-dos app built by Claude in React.
00:00:54For testing purposes, I wouldn't actually build this app
00:00:56for any other reason than to test.
00:00:58But anyway, I'd like to add a dark mode toggle
00:01:01because this is blinding my eyes.
00:01:02I'd also like to add the ability to save this
00:01:04in local storage because if I refresh, it doesn't save.
00:01:07And I'd like to add the ability to edit to-dos.
00:01:10Now, usually I'd put all those features into one prompt,
00:01:12so dark mode toggle, local storage,
00:01:14and the ability to edit to-dos.
00:01:16The problem with that is if one of these features had a bug,
00:01:20then I'd have to work on the whole thing,
00:01:22so delay the other features from being released
00:01:25because everything is on the same PR or the same branch.
00:01:28But with work trees,
00:01:28I can work on these features in separate branches
00:01:31at the same time on my local machine
00:01:33without having to do any manual setup.
00:01:35And if there is an issue with one of these features,
00:01:37I can push the other two features
00:01:39and work on that one on its own branch.
00:01:41So let me show you how to do that.
00:01:42So if I do Claude Code with the W flag,
00:01:45then that will give me a work tree
00:01:47with a random name chosen by Claude.
00:01:49Wait, Lacan?
00:01:50Okay.
00:01:52But if I wanted to give my work tree a name,
00:01:54I'd give it a name after the W flag,
00:01:56which I'll put it under here.
00:01:58This gives me a new work tree over here,
00:02:00and it also creates a new branch,
00:02:02but doesn't delete the previous work tree that we created.
00:02:05So keep that in mind
00:02:06if you end up making a lot of temporary work trees.
00:02:08And in the .claud directory of the project under work trees,
00:02:11we can look at our work tree
00:02:13and see all the code files associated with it.
00:02:15Note, work trees only work
00:02:16if your project has git initialize
00:02:18and you've made at least one commit.
00:02:20Now I can go ahead and implement all the features
00:02:22to this project in different work trees.
00:02:24So now all the three features have finished
00:02:26and we can see here that the dark mode toggle works.
00:02:29In this one, there's no dark mode toggle,
00:02:31but I can edit the to-do.
00:02:32So I'll add a new one and change it here.
00:02:35And in the local storage one, there seems to be an issue,
00:02:38but this is the benefit of work trees
00:02:40because I can see that the other two work well.
00:02:43So I could commit those or create a pull request
00:02:44and I could focus on this one
00:02:46and I could use a dedicated Claude Code session
00:02:48to fix this issue.
00:02:49And when I'm done with the work tree,
00:02:51I can either keep it so I can go back to it later
00:02:53or remove it from my system.
00:02:54If I decided to keep it,
00:02:55I could go back to the exact same work tree
00:02:58if I specify the name, as you can see here.
00:03:00I could even resume sessions from my current work tree
00:03:03or press Control + W to see all the sessions in this project.
00:03:06Although I'm not quite sure
00:03:07how it works out the current session,
00:03:08since right now I'm on the main branch.
00:03:11Speaking of current session,
00:03:12if you wanted to work from the work tree directory,
00:03:15you could either navigate directly to it
00:03:16using cd.claud work trees and so on,
00:03:19or you could run work trees with the tmux flag,
00:03:21which will take you straight to that directory.
00:03:23And if I opened up a new split pane,
00:03:26you can see I'm in that work tree
00:03:27and I can navigate through the work tree specific files.
00:03:30But the coolest thing about work trees
00:03:31is that they support sub-agents,
00:03:33meaning I can get different sub-agents
00:03:35to work on multiple features in different branches
00:03:38in the same Claude Code session.
00:03:40And if you want work tree support in custom sub-agents,
00:03:42so a custom sub-agent will automatically spin up a work tree,
00:03:45all you have to do is add this isolation work tree
00:03:48in the front matter and Claude will take care of the rest.
00:03:50Overall, I'm really impressed with this feature
00:03:52and it's something that I'm definitely
00:03:54be going to using more of,
00:03:55particularly with the new work tree hooks
00:03:57that allow you to use work trees without git,
00:04:00so SVN, jiu-jitsu, et cetera,
00:04:02and also to run scripts automatically
00:04:04when you create a new work tree.
00:04:05But unfortunately, it seems a lot of people
00:04:08have been having issues with work trees
00:04:09since the latest Claude Code updates
00:04:11because of what looks like a broken feature flag.
00:04:13Luckily, you can get Claude Code to fix its own binary
00:04:17as a temporary measure,
00:04:18but hopefully the team will have a proper fix later on
00:04:21so that more people can experience this awesome feature.
00:04:24Speaking of awesome features,
00:04:25if you're a React developer and want a CLI tool
00:04:28to automatically detect React anti-patterns,
00:04:31then check out this video from Andris
00:04:33that goes through React Doctor.