Skip to content
Episode 493

493: Git's most powerful but underutilized tool

December 15th, 2025

55 mins 53 secs

Your Hosts

About this Episode

In this episode of 'Merge Conflict,' James and Frank dive into the intricacies of Git work trees, exploring how they revolutionize local machine development by allowing developers to manage multiple branches simultaneously. Frank initially struggles to grasp the concept, but James breaks down the functionality, explaining how work trees enable parallel branching and commit management. From managing complex code branches to optimizing lighting setups, this episode is packed with insights that are both educational and entertaining, making it a must-listen for developers and creatives alike.

Follow Us

⭐⭐ Review Us ⭐⭐

Machine transcription available on http://mergeconflict.fm

Support Merge Conflict

Transcript

James 00:00

Welcome back, everyone, to Merge Conflict, like your weekly developer podcast where we develop. I'm James. That's Frank over there. I'm a little bit cool. He's a little bit warm. And this episode is all about a bunch of spiciness. How's it going, Frank?

Frank 00:16

That's right. ah Boy, you know, hot, cool, warm, none of those mean anything, because if you look at the color temperature of cameras, they're actually opposite. Cool colors are high temperature. Warm colors are low temperature. ah Spicy food is hot, even though it's not, you could have cold spicy food. What does anything mean in this world? Wonderful to see you, James.

Read Full Transcript Hide Full Transcript

James 00:40

Uh, you hate my lighting, Frank, if you're watching on YouTube, i I usually set it relatively. I'm not a video person, right? I'd have to like call up Cameron and be like, Hey, so I'm i'm usually a rock, like 5,200 Calvins, Calvins.

Frank 00:55

A little hot in here. ah h It's like you're up on an ah in an airplane.

James 00:58

but But I set it down to 34% brightness. right So if I set that, I'm at 34. But if I'm all the way up to 100, it's like, wow, it's like real. But then I do this. Yeah. So I don't know if people have recommendations for me, i would love that. I have two Elgato key lights, a left and a right pointed at me over here. And then I have obviously pure white walls pretty much that are eggshell.

Frank 01:27

Wow.

James 01:27

I think they're eggshell. Yeah. And, uh, that's kind of where I leave it. I don't know. I do feel like I'm a a little bit. Paler than I should be like in real life. I think I'm more, I have a little tan.

Frank 01:39

I call it the severance look. No, what you got to do for the full movie effect is you need one really cool, one really hot. Then you get the blue and the orange. You get your oranges and your teals. You get both in the same shot. And then if you want to go full Hollywood, you just have to have a purple light like blasting you from the top.

James 01:51

Mmm.

Frank 01:55

And then it looks like stage lighting.

James 01:55

So I could do, how's that?

Frank 02:00

It's definitely not what we're used to.

James 02:03

So that would be like one, one really warm and one cool.

Frank 02:03

Boy. Yeah, it's not quite dramatic enough. But yeah, ah stage lighting is so strange. Like when you watch the high production YouTubes, people have so many colors mixed in there. It's kind of crazy, honestly, I think. I watch a lot of Corridor crew, and they have like high, strong purple lights along with green lights shining on them. I'm just like, I'm not willing to go there. Nope, not doing it.

James 02:32

Well, if anyone has any recommendations or wants to hop on a like this,

Frank 02:34

I like this. I like what you just did. Yeah, you're looking good. You got got some specular over on your left. Looking good, James.

James 02:43

but The walls are no longer white, and which is what they are. But so what I just did is I, my left light over here is at, they're both at a very low percentage. So both of them are at about 10% brightness. It was like 10% brightness. We're getting moody. But one, the left light is 100% at And the right, this one,

Frank 03:00

Mm-hmm. Heck yeah.

James 03:08

is one hundred percent cool at seven thousand

Frank 03:12

That's what I'm talking about.

James 03:12

But I, but i

Frank 03:13

Contrast, baby. that's That's what makes things look good.

James 03:17

yeah, I could play around with it. Um, all right, let's get in to this week's topic that I picked out for us.

Frank 03:18

ah

James 03:24

What is a work tree?

Frank 03:27

What is a work tree? um Is that what you put your shoes on so they don't get smelly? I need one. ah I mean, um excuse me, my friend and needs one. Their boots keep getting smelly. I think they need a work tree.

James 03:43

that No, it's not tree that goes to work for you.

Frank 03:44

Nope, dang.

James 03:46

No, um we're talking about a git work tree.

Frank 03:49

Oh, okay. I feel like I should know this. um Is this, this is...

James 03:53

Ah, oh, oh, hold on. Before you even say anything.

Frank 03:56

Okay.

James 03:57

The reason that we're doing this episode is that we're at a pivotal point for Git and how we build software on our local machine because Git work trees, in my personal opinion, have never been really that important until now, until a month ago or two months ago, and all these agentic developer tools started to integrate work trees into it.

Frank 04:01

Mm. Mm. Uh-oh. Oh, boy. Oh, boy.

James 04:21

But no one knows what a work tree is. So I want to talk about what a work tree is and then why you want to use it. And Frank doesn't even know what a work tree is.

Frank 04:28

We're doing an education episode.

James 04:29

and yes, yes.

Frank 04:31

i feel like isn' it am I wrong? Isn't this just like the staging time? So like you have your commits, you got your branches. Those are very understandable. And then you're doing some edits and you're like, get add. Isn't it added to the work tree? Am I crazy? Isn't that what the work tree is? Or am I crazy?

James 04:48

No.

Frank 04:49

Nope, completely off. Okay. Is this some feature they added to get like three years ago and no one paid attention to? Sat closer?

James 04:57

Uh, when was work tree added to get, uh, get work trees.

Frank 04:59

ah

James 05:06

Hold on. Copilot is spinning up here. it was added in

Frank 05:11

10 years ago. OK, so I'm a little bit slow to catching up. Fair enough.

James 05:15

a bit if you think of a work tree like this, when you clone a repo, Frank, uh, set it. Correct. You have a branch. You also have. let's say in all intents and purposes, a work tree, right? Like you have one work tree and you have branches off of that one work tree. Okay.

Frank 05:37

Fair. I mean, what what you really have is a hierarchy of commits and a branch is just a pointer to one of those commits.

James 05:43

Correct.

Frank 05:43

that's I prefer to keep it in simple database terms. Branches are pointers and the rest is just a tree of commits.

James 05:47

Yeah. Yeah. That makes sense. Yes.

Frank 05:53

Mm hmm.

James 05:53

Um, now Let's say you wanted Frank to work on two branches at the same time on your machine.

Frank 06:03

Oh, gosh. Nope. Nope. Nope. Not going to happen. Never. I do this sometimes, and then I just forget about the other branch and it goes away. um The other way I do it is I just make a second clone of the repo and keep out of a separate directory because that's how sophisticated I am. That's how I keep things straight. um Oh, boy. Yeah, I mean, I would just do two different branches. That's what I would do. If I'm working on two different things, two different branches.

James 06:31

just toggle between them.

Frank 06:32

That's how I roll. toggle as in type git checkout because I still rock the command line. I didn't, I, to this day, I still don't trust any, uh, git GUI stuff at all. Full stop. Period. Visual Studio, VS Code, get out of here.

James 06:47

it.

Frank 06:49

I'm command line only.

James 06:52

Uh, yeah. Okay. So this makes sense. Okay. So when is there a case where you'd want to have multiple branches checked out at the same time on your machine? And the only way to really do this, okay.

Frank 07:03

Oh, constantly.

James 07:05

Yes. Constantly AB b testing, AB b testing.

Frank 07:06

Constantly. Yeah, sure.

James 07:09

Um,

Frank 07:10

Working on two different things. Like, i'm I'm working on a feature right now, and a bug report comes in from a user, and I need to work on that bug. You switch back to main, do a new branch off of main, work on that bug there.

James 07:21

Mm-hmm.

Frank 07:22

Later on you're going to have to deal with the wonderful merge conflict that inevitably comes up. But, you know, um that is the get life merge conflict in.

James 07:32

Yeah. So there's that reason. Uh, you might want to, like I said, AB tests, you might, yeah, I want to be working on a feature and a bug, something come up.

Frank 07:38

Mm-hmm.

James 07:42

You don't want to like, often you're working on a feature that you said, a bug comes up. You don't want to like mucks that together. So there's one of way, two ways of doing it. Frank described it. One, I think the worst part of my personal opinion is let's say you're working on code and like, I gotta to fix. I got a critical bug. My boss is like, go do this thing. Do you stash it? Oh, here stash it.

Frank 08:00

No, never stash.

James 08:02

You committed, I guess commits are free.

Frank 08:03

I live the no stash life.

James 08:04

Yeah.

Frank 08:05

You know, it's funny though, because um a coworker of mine stashes everything. And it just freaks me out because like, there's nothing keeping that stash alive.

James 08:09

Yeah.

Frank 08:14

Nothing at all. Just just the whims of whoever implemented Git. i I guess you could say that for all of Git. But I feel so much better when there's actual commits. I hate stashes. Commit that puppy. Create a new branch if you have to. Commit that puppy.

James 08:28

Yep. So that's fascinating. Heather is a stasher. She's a, she's a, she's a, she's a, she's a stasher.

Frank 08:33

Oh, no. Whoa.

James 08:36

She's like, Oh, let me just stash. was like, Oh yeah.

Frank 08:38

That's a personality test, I feel like. Yeah, we should just, at every conference, ask someone, stash or commit.

James 08:43

Yeah. Spaces or spaces or tabs. And, um, I, I do think it's really fascinating to think about that because yeah, you have to do one of two things to be able to, to, to do that. You have to either commit or stash and then switch contexts, go over here, you know, hope your ID response to stuff. You have made that many drastic changes, close the thing where you go, reopen it. Um, The other thing is you said it earlier, which is the thing I used to do all the time, which is I would just copy the folder, clone it.

Frank 09:12

Yeah, baby.

James 09:14

So I'd have my app copy one. And then guess what? That entire clone of the folder is now is is, is ready to go. It's like, Hey, let's do this, you know? And it sends off to the races.

Frank 09:25

Yeah. Sometimes I just declare get bankruptcy sometimes too. Under two conditions, I've totally screwed up a commit. like Usually it's a partial rebase or something where I've just created an absolute disaster, and that's when I'll create... like ah I'll just go bankrupt. I call it get get bankruptcy, and you just start with a fresh clone. I think the other time is It's just when you're you're getting too many local branches and you don't want to push them up and I'm just getting nervous. like ill i'll

I'll go so far as like say I'm like code reviewing someone else's PR. Sometimes I'll have a separate directory just for PRs because i don't want them to mess with my main one or mix in a bunch of weirdo branches into my local stuff.

James 10:06

Yeah. Yeah, it makes a lot of sense. Yeah, I think this has been one of the biggest problems I think, honestly, probably because of just tooling and or lack of knowledge of the feature. I hadn't really ever been introduced to WorkTrees at all up until a few months ago when the ability to manage WorkTrees Landed in VS Code.

Frank 10:34

Oh, okay.

James 10:34

I actually interviewed the engineer that worked on it for the VS Code Insiders podcast, VSCOpodcast.com. You can go check that out. But it landed this summer, I want to say, inside. And ah I was like, well, I guess I need to figure out what it is. Well, let me tell you what it is, Frank. WorkTrees.

Frank 10:52

Oh, I'm excited. Okay, what is it?

James 10:54

WorkTrees, they allow you to check out multiple branches simultaneously on your local machine.

Frank 11:01

insanity.

James 11:02

How does this work? And I'm glad you asked.

Frank 11:04

OK.

James 11:05

What they do is it, um, for all intents and purposes, it's doing the thing that I just kind of talked about is it is making a copy of the source code of a branch that you specify and putting it in another folder. So if you have my app, that's the folder you would in the route. let's say you have C slash my app. You say, let me create a work tree. You can specify the work tree of any branch you would like to create it off of. So you might have a work tree, uh, off of.

Frank 11:35

OK.

James 11:38

Uh, main, which is called experimental or experiment one experiment to experiment three. You might have one called hot fix, get up, blah, blah, blah. It's basically, you're creating a, a, you're going to create a work tree off of a branch with a branch name. So all you're doing is creating a branch of a branch, but you're saying that this is a work treat, not a standard branch.

Frank 11:54

OK.

James 11:59

Okay.

Frank 11:59

But you usually start with a branch. That's usually your starting point for a work tree.

James 12:04

Uh, you can do it off of main. mean, it's fine.

Frank 12:06

ah Sorry, Maine is a branch. Maine's just the name of the first...

James 12:09

Main is a branch.

Frank 12:10

bre Yeah, it's all branches all the way down.

James 12:10

Yep. Yep. Yeah. It's all the way down. Exactly. Now you might be saying like, Hey, and know I'm going to work on this feature. So let's say you have like, you know, login redesign. So normally you're like, okay, I've logged redesign. then you're like, I'm going to get to work. Well, actually I want to have like three different designs. So what I'm going to have then is I'm going to create three work trees off of redesign and call it redesign one redesign to redesign three.

Frank 12:33

Okay.

James 12:38

I can open up all three of those in different instances of VS code and be working on all three of them at the same time. And then I can merge that work tree back into the branch that it was created off of.

Frank 12:45

Cray cray.

James 12:48

Okay.

Frank 12:50

Oh boy. Okay. Where do you even begin? Okay.

James 12:53

Well, me tell you it works. Let me tell you how it works. So when you do this, Frank Kruger, it will create another folder called, you know, my app dot work trees, and then create the work trees in that folder.

Frank 12:54

Okay. Uh huh.

James 13:05

So they're nicely organized in a separate folder between them.

Frank 13:06

Okay.

James 13:09

Okay. Now, when you go into VS code, you go into VS code, you can do it alongside with me, go into VS code, go in.

Frank 13:10

Okay. All right.

James 13:19

Go. Yep. Yep. Okay.

Frank 13:22

I'm in it.

James 13:22

You're in it. Okay. Go into your source control. That's the little thing that looks like a little branch. Okay.

Frank 13:28

Love it.

James 13:28

See up source top you have source control. Do you have repository changes and graph?

Frank 13:32

m Let me open a project that's probably going to be helpful for this experiment.

James 13:39

Step one, open said project.

Frank 13:41

ah Okay, I have changes, changes, and graph.

James 13:47

Ah, cool. So go up to the triple dot under source control and check repositories.

Frank 13:48

Did that help? Aha.

James 13:52

Okay.

Frank 13:53

Oh, okay. um Still not finding it, James, but okay.

James 13:56

Okay. The repositories just as repositories source control. There's a triple dot at the very top.

Frank 14:05

Nope, pull, push, clone, checkout, too, fetch, commit, changes, pull, push, branch, remote.

James 14:08

Nope. you Nope. One up. You got to go higher source control.

Frank 14:11

oh So high. Oh my. Let's see. Okay. Look, I'm going to blame VS Code for this. there are There's at least six different three dot things on my computer.

James 14:19

All the way to the top.

Frank 14:20

I found it, James. Repositories.

James 14:22

Notorious.

Frank 14:22

Okay.

James 14:23

Okay.

Frank 14:23

Got it.

James 14:23

Then you see the name of your app. It looks like there's a little book there.

Frank 14:26

Yep. Mm-hmm.

James 14:27

You're on a branch. There's a little spinny icon.

Frank 14:28

Mm-hmm.

James 14:29

There's a little creative pull requests icon.

Frank 14:31

A little cloud for me. Yeah, it's cute.

James 14:32

Then there's a trip. Then there's a triple dot more actions.

Frank 14:34

Of course there is. Yeah.

James 14:36

This is your pool, push clone, check out fetch.

Frank 14:39

Yeah.

James 14:39

Okay. Work trees, create work tree.

Frank 14:42

Oh my god, what's going to happen? OK, there's a dot dot dot after it, so I better bring up a dialog box.

James 14:45

So pick a branch.

Frank 14:49

Ooh, it brought up the only dialog box VS Code has. So I pick a branch, or should i create a new branch?

James 14:52

Yep. Yeah. Just pick a, you can do either. Yep.

Frank 14:57

Yeah, I'm going to pick a branch, James. I'm going to pick main, because that's how I roll. It says branch main is already checked out in the current repository. Create new branch. All right, fine.

James 15:08

Oh yeah. i guess you do need to do it off a branch.

Frank 15:09

I'll create a new branch. Okay, they want a new branch.

James 15:10

Okay. Call it new branch.

Frank 15:12

I'm going to call it James because that's a good name for a branch.

James 15:14

I'm calling mine Frank.

Frank 15:16

ah

James 15:17

Ah, yes. I guess you need to have a branch and then it puts it in the branch name. Okay. So then it's going ask you where you want to put it

Frank 15:22

Right.

James 15:24

Mm-hmm.

Frank 15:24

and it is putting it in um so project name dot work trees so it's like um it's a new top level directory though which is kind of interesting so it's not like a dot work trees directory in the directory it's a whole and nother directory fascinating

James 15:24

Mm-hmm. Yeah. And I think what was happening there when we selected, when we were selecting main, I think we are creating this new work tree off of main. Cause it's like the thing that we currently have checked out. I'm pretty sure.

Frank 15:57

Okay.

James 15:57

I think. Yeah.

Frank 15:58

Well, I have a thing called James now. i'm I'm now scouring my computer to figure out what it's done.

James 16:01

You do.

Frank 16:05

Okay, so it did create a whole new top-level directory. So let's say my project was called project. There's now a new folder called project.worktrees, not project slash dot worktrees, project dot worktrees.

James 16:17

Correct.

Frank 16:18

Interesting, interesting. but us And then there is a slash James under that. Fascinating.

James 16:25

Yep.

Frank 16:26

Okay.

James 16:26

So what has happened here for all intents and purposes is that when you call get in it or get clone, that's going to create your main work tree, which is what we're working off of, but this is just created a new link work tree. So a repository has one has one main work tree.

Frank 16:38

Mm-hmm.

James 16:41

It's the one in the repo and usually zero link work trees. And I have a link to work tree. So now you have a link work tree and it's there and now you can work off it and you can create more work trees. So if you want to see, you can have James one, James two, James five, James 10. And here's the cool part.

Frank 16:56

Oh, I'm doing it.

James 16:57

Now, what I want you to realize though, in your VS code, you're still on main Frank. Look at your bottom left.

Frank 17:03

I guess I don't even know what I'm on, man. i am i am in a new universe, it feels like.

James 17:06

Yep. No, you're, you're in bottom left. You're in bottom left, bottom left. See, it says main.

Frank 17:11

Uh-huh. It does say main. I'll grant you that.

James 17:13

Okay, so go to the James work tree under changes, or even actually under repositories, you see, you see your project, then James, James branch, go to the triple dot dot.

Frank 17:19

Mm-hmm. Yeah.

James 17:24

dot

Frank 17:25

But is it a branch? It is a branch.

James 17:27

It is a branch, but then you can go to work trees and you can say open work tree in a new window and you'll get a new VS code with that branch of the work tree that is on your machine.

Frank 17:28

Okay. Aha. That totally worked.

James 17:40

Okay. Yes.

Frank 17:41

That did work. I would admit that worked.

James 17:42

That. Yep. So now, so now you have two VS codes, put them side by side people.

Frank 17:44

ah

James 17:48

So on the left you have main and on the right you have James.

Frank 17:48

I did.

James 17:53

Okay. Now go into your read me.

Frank 17:54

Can I tell you something that I like already? Sorry, to just to interrupt you.

James 17:57

Go ahead.

Frank 17:59

um You know, I keep a lot of files in my projects that aren't actually a part Git because that's how I roll.

James 18:06

Yeah.

Frank 18:06

um This was fun because this did the kind of thing I was talking about before when you get too many files in your Git and you just want to clean one and you like do a reclone of it. Because obviously when it created this James work tree thing, it only brought over the Git controlled files, nothing else.

James 18:15

Yeah.

Frank 18:23

So it was actually kind of a fun, quick way to just see um not the garbage that I normally, all the detritus that I keep around in my directories.

James 18:23

Correct. Not the garbage. Yeah.

Frank 18:32

So I like that part already.

James 18:32

Yep. So now here, um, if you go to your James branch that you've created, go to your read me and just update the read me to say James and save it.

Frank 18:41

Mm-hmm. Mm-hmm. James approved. Yep.

James 18:47

James approved. Cool. Now what, then what I want you to do is go back to your other repo.

Frank 18:52

Yep.

James 18:56

The other VS code, which is on main, and then you can see there's changes.

Frank 18:58

Aha. Yep.

James 19:01

Okay. And then what you're able to do is now commit those changes to that branch on that machine. Right?

Frank 19:13

I didn't change anything on my main.

James 19:14

No, you didn't, but see where it says changes. This has main Anna has Frank or James underneath it.

Frank 19:20

Uh-huh, I can do it there.

James 19:21

Yep.

Frank 19:22

Fair enough.

James 19:22

You can do it there. So you can do it in either.

Frank 19:24

Oh! Right, got it. Okay. Boy, this is not going to confuse me at all in the future.

James 19:27

Okay.

Frank 19:31

I'm just kidding.

James 19:31

Yeah, but it's kind of crazy, right?

Frank 19:32

Well, I'm not kidding.

James 19:33

You now have two branches checked out at the same time where you'd be working on two different problems.

Frank 19:34

Yeah. Let's see how good their sync is.

James 19:40

Okay.

Frank 19:41

i am going to commit this, buddy. Commit. Commit. I have a bug report already. I committed on the left window. oh wait.

James 19:51

You got to click here.

Frank 19:51

No, no. I got to do a commit message. Hi.

James 19:54

Mm-hmm. You might get the little refresh button on the other one, but okay.

Frank 20:07

Oh, no. ah When I switched back to the window, it updated the UI. So, OK. So you do have to do the little switchy switchy switch.

James 20:12

Oh, perfect.

Frank 20:14

But yeah. Okay, that worked. That worked. um

James 20:19

Okay.

Frank 20:19

It's still just in a branch, though. So i to get some reassurance here, James, I just need to go at the command line, get branch list to prove to myself what the heck is going on with this thing.

James 20:28

Hmm.

Frank 20:31

Okay.

James 20:31

But you're in a work you're in a work tree now, so remember that.

Frank 20:34

I don't know what that means, but OK. the I mean, the branch is there. um Fantastic. OK. What happens if I go to the command line version of this new directory? I'm curious.

James 20:48

good question. What does it say?

Frank 20:50

I am almost there. If you go into work trees, nothing. If you go into James, it looks like a git directory. Fascinating. Fascinating. And if you print the git directory, Nothing. Oh, OK. the Fascinating. the got The dot get directory is not a directory. It's some fancy work tree thing. Great.

James 21:23

It is a work tree thing.

Frank 21:24

that's That's as far as I'm going to dig into that.

James 21:27

Correct. So it's like not only created that branch, but it's also created this work tree where that branch lives. Right. So think of it as basically the, it's a little confusing because the name of the, the name of the work tree Frank and then your branches Frank, but now your work tree can have multiple branches inside of it.

Frank 21:40

Yeah. Yeah.

James 21:45

Okay. And you can have multiple work trees as well.

Frank 21:47

yeah

James 21:48

on it. And then ideally the other thing that you can do is you want to get those changes in that work tree back into your main work tree. It's kind of like a flip of the script, which is like, Hey, I have like a bunch of branches, but now I actually have like multiple work trees that have multiple branches that I'm working off of to put back into my actual main line work tree and main branch.

Frank 22:12

Yeah, and it's fascinating too because this work tree really is a special place. So I just, the big question I had was like, are the remotes the same and things like that? And as far as I can tell, the remotes are the same. So I don't even know how this Git file is actually pointing back to everything. It's honestly awfully confusing. I should say, it's not it's not awfully confusing.

James 22:34

It's a little confusing, yes.

Frank 22:37

Conceptually, it's pretty simple. they They made another directory with um my repository, created a subdirectory for the the start of that work tree. Fine. Because I actually have two. I have James and James2 now. So that's fine.

James 22:52

Yeah.

Frank 22:52

Yeah. It could get confusing, but I'd say this probably is better than me just cloning two different directories. that that you know That's that's the the bar I'm measuring this against. I feel like, because both of those can obviously be confusing. I'm feeling like this is probably better. I'm a little more okay with this, actually.

James 23:13

yeah So here's exactly what happened. So when you create a work tree in Git, you're essentially telling Git, give me another working directory that's tied to the same repository, but checked out to a different branch or commit. So literally step-by-step here's what's happening. A new directory, which you said is specified. The directory looks like a normal Git working copy, but it doesn't have its own Git folder. Instead, it has a small.git file that points back to the main repository's object database. This is a huge thing in which you just investigated, correct?

Git records in the work tree has its own internal metadata, which are inside.git slash work trees.

Frank 23:47

Yeah.

James 23:53

And this keeps track of which branches are checked out to which work trees. So you don't accidentally check out the same branch in two places. So what this allows you to do is work independently in that new directory, in that new directory commit, merge, run tests. It behaves like a full repo checkout, but it shares the underlying objects in the main repo.

Frank 24:10

Yeah.

James 24:12

So why would you really want to do that, right? Like we said, it allows you to check out branch X on a work tree. And then, you know, that way don't have these like conflicts, basically, when you're doing work. And it also saves space because you're sharing the same object database. So you don't duplicate the entire repo because one of the problems is if you were to download VS code and then you needed to work on two branches, it's like a gig each, right?

But really a lot of visit in that is in that dot get folder.

Frank 24:37

Mm-hmm. Yeah.

James 24:40

So you save tons of that. So creating these work trees gives you a lightweight parallel workspaces. right to keep your main spin up work trees for hot fixes work on experiments that we don't to worry about juggling stashes or clones or things like that in general

Frank 24:56

Yeah, and I was just doing a tiny bit of investigation. So yeah, that.git is actually just a text file pointing back to an absolute path of the actual.git. slash sorry the docket slash worktre so yeah, it created a new little subfolder And it's interesting because that the WorkTree subfolder is very much like a.git, because it has refs, it has head, it has index, it has logs. who Who cares about logs?

James 25:29

Yep.

Frank 25:30

But it doesn't have objects. It doesn't have the actual data. So because it has refs, it is acting a lot like an actual git checkout, but it's doing the magic so that the the object database is shared. Really fascinating stuff, which really makes me think you can really hack around with this.

James 25:46

Yep.

Frank 25:52

And put the WorkTrees stuff anywhere on your computer. So long as that, yeah, so long as that git, the.git file points back to the WorkTrees subfolder of your.git.

James 25:56

Oh, totally. Yep. Yep.

Frank 26:07

Yeah, not bad. Not bad. But that also explains, I should say, there's no config file there. So that explains why the remotes are the same. I have to assume all the submodules would be the same. as Submodules get a little bit weird, though, so I'd like to see how it handles those exactly. But it looks like it's only really making a copy of head and refs, which are your your pointers into the object database, into the commit database.

James 26:33

So now you'd be saying, I made these changes. How do I get them back into Maine? How do I get them back into my main work tree?

Frank 26:41

I assume it's sharing the refs folder. So if I merge something into um the the named main branch, it would just go there. like I'm feeling like it's just going to rewrite the main ref, the main branch, to be the commit that I tell it to be. Is that it? do i Can I just say that? Can I just merge it on into the into a different branch?

James 27:11

I like, oh yeah. Like, could you take the work for them, merge it back into main maybe in VS code, go to the, go to the command, go to the command palette up top and then do, you know, less or greater than, and then type in work tree and you're going to see migrate work tree changes.

Frank 27:16

Mm-hmm. Okay. Not the recommended way. Okay. Okay. Yeah. Uh-huh. Yeah. What? What does that mean? You're really blowing my mind tonight, buddy.

James 27:35

Um,

Frank 27:40

Oh, okay. You want to do this on the main repo side, it seems like.

James 27:43

Oh, yes, you need to do that on the main repo side. That is correct. Yeah. Not on the actual.

Frank 27:49

Oh my god, it just created something called Dirty Taken. What does that mean? That's hilarious.

James 28:01

Think, I think you might also have to, i don't think you have to publish it Migrate work tree changes. i have mine says none are available. But the migrate should bring it back to it.

Frank 28:21

Oh, you know what?

James 28:21

Migrate.

Frank 28:23

I'm bad at following your directions. What I did instead was create work tree with defaults.

James 28:26

Oh.

Frank 28:29

And with defaults means it made up some random name.

James 28:30

and

Frank 28:32

And the random name is terrible. It's called dirty hyphen taken. Terrible, terrible git people.

James 28:36

Oh.

Frank 28:39

Let me try again actually doing what you told me to do. OK, migrate work tree changes. Bam. OK, now I can say select a work tree to migrate changes from James.

James 28:52

From, yeah, into.

Frank 28:55

And I don't know where they went, but that was it.

James 28:59

Yeah.

Frank 29:00

There are no changes in the selected work tree to migrate.

James 29:02

Yeah. so so So like we can, well, cause we committed it, right?

Frank 29:02

it's Fascinating.

James 29:05

So then in that instance, you would publish and then merge and do all this stuff. But let's say you had a um a change that you didn't want to commit and you're like oh i want to move it back into the main or whatever.

Frank 29:09

Hmm.

James 29:16

You can just move it around from work tree to work tree. We committed the code, so then like the code's in that branch.

Frank 29:20

OK. OK.

James 29:23

so I think in that instance, you would just merge the branch back in like you're saying.

Frank 29:27

Right, right, OK.

James 29:28

You'd publish it, merge it, it would work.

Frank 29:28

I'm not going to do that because i don't actually want a James-approved commit into my main.

James 29:32

Correct.

Frank 29:33

But yeah.

James 29:33

Correct. Yeah. So it, so the migrate changes, like you to say, I have these change, haven't committed them, but just like, I want to put them back into my main now so you can move them over without having to commit them to get, because work trees are going to kind of just throw away anyways.

Frank 29:34

i

James 29:45

so if you're just like, Hey, I have all these changes.

Frank 29:46

Hmm.

James 29:47

I tested them, push them on over basically. Does that make sense?

Frank 29:51

It does. um And especially because it looks like even the head file for the work tree points back to the main ref heads, James.

James 29:52

Yeah.

Frank 30:04

So I think all the merging stuff's just going to work.

James 30:04

Mm-hmm.

Frank 30:07

Without me actually doing it, just chasing around git pointers, it looks like.

James 30:07

Yep. Doing that.

Frank 30:12

It would do exactly as we would expect, yeah.

James 30:14

Do that stuff. Yeah. So if you didn't want to go through the thing where like, oh, I'm merging, I'm doing this stuff.

Frank 30:16

Mm-hmm.

James 30:18

I'm on my machine. I'm like, I got these changes. They're looking good. Let me just put it, especially when you're working off a branch. So for example, you're working off a branch, you have design. So you might, so in this instance, you're like, hey i have, I have, for example, you know, redesign every design one, two, three. why Why go through the process of committing, merging into the branch, which is just going to be merged again into the branch. You just say, take all my changes that I have, move them over here, x Y, Z, handle merge conflicts, do a thing. So that works out pretty nice.

Yeah. Without having to commit any code. So you can basically say all my changes that are uncommitted right now, move them from one of the work trees back into, you know, a branch without having to commit.

Frank 31:02

Yeah. And I'm starting to get a feel for this. like um I was going to say before when we were we were first starting out that like um a pro tip, if you need to get clone something, you don't always have to point at the remote.git file because then you have to download it all from the internet again.

James 31:06

Yeah. Yeah. Mm.

Frank 31:22

If you're ever cloning, pro tip, you can reference a local.git file and just clone from that.git. And it feels like this is doing basically that. with the added benefit that it's sharing the object database. And obviously now it's sharing the refs database also. And that's that's kind of the freaky part. Because usually when you have two different.gits, you have two different sets of.refs or slash refs. um So this is this you could definitely shoot yourself in the foot with.

James 31:49

Yeah.

Frank 31:53

But it's also obviously very powerful.

James 31:56

It's a little, it can get a little funky to kind of wrap your head around it, but why is this important? Well, Frank, you've updated your VS code in the last two days.

Frank 32:04

I believe. i believe. Every time I start getting a bunch of tweets about get doing something, I'm like, God, is there an update? And then I do the update.

James 32:12

Okay. So, um open up your Github Copilot chat.

Frank 32:17

Oh, you're going to? I have to restart to update. It's going to happen.

James 32:19

Okay. Restart to update.

Frank 32:20

ah ah Yeah, yeah.

James 32:20

It's going to be quick. It's going to be quick on here. So, so the reason you're like, I'm thinking about this before is, you know, how often am I doing this and why is, why our work trees important?

Frank 32:31

Mm-hmm.

James 32:31

And the answer is, It's been a nuisance to do what we just talked about, but because we didn't really need work trees, we're doing it very rarely. However, in the world of a i you are spinning up many experiments. You're spinning up a whole bunch of ideas and you have an idea and you just want to fire it off and let it do its thing and check it out on your local machine.

Frank 32:47

Fair enough. Right.

James 32:52

And you have to wait around, right?

Frank 32:56

Don't want to be cloning. i mean i mean, you could. So the alternative is you clone, clone, clone, clone.

James 32:59

You could.

Frank 33:01

So this is just a more efficient cloning technique in that regard.

James 33:05

Correct.

Frank 33:06

Okay.

James 33:06

Well, and imagine that you have an agent like Copilot that's like, Hey, let me go work on this in the background. And imagine if i had to clone the entire repository before it could get to work again, into a new folder that you specified with a new branch.

Frank 33:17

Right. Yeah. hu

James 33:21

Instead, it could leverage work trees.

Frank 33:25

And if you're a nut like me, I do all my Git work under a Dropbox folder. Insert your favorite document sharing service here.

James 33:31

Hmm. Wild.

Frank 33:35

ah It's kind of nice because then you have two backups of everything. i Just saying. Two history recorders. If I really mess up one, the other one can be kicked in. um What's nice here is when I did my old um do two clones of the same repo thing, there were a lot of duplicate files, especially for an old project because the object database, basically.

James 33:52

Yeah.

Frank 33:55

um this doesn't have that issue. ah It's sharing the object database. So it's actually very lightweight for my Dropbox. Like um probably should turn off my Dropbox when we're recording podcasts. And yet here I am verifying like the Dropbox is all caught up and everything because it has very few files to sync because it really just did a bunch of copies of a few files and then it's just the ref files.

James 34:14

That's true. Yep.

Frank 34:19

And there's actually no ref files here.

James 34:20

Yep.

Frank 34:22

Basically, it's just a couple.

James 34:22

easy now.

Frank 34:23

Yeah, so this is very lightweight.

James 34:24

Okay. VS code open.

Frank 34:26

VS Code open. Do you want me in the work tree or the main tree?

James 34:30

Uh, it died. Don't, it doesn't even matter. Just main tree.

Frank 34:32

Oh, OK, yeah, okay

James 34:33

Okay.

Frank 34:35

ah What do you want me to do, James?

James 34:37

okay Open up the getup co-pilot chat.

Frank 34:40

Uh-huh. It's always open.

James 34:40

Okay.

Frank 34:41

Come on,

James 34:42

It's always open. Okay. Do you see the plus button? Then you see a little chef.

Frank 34:47

There's chefs everywhere. um Yes, plus new chat, new chat editor, new chat window.

James 34:53

New background agent?

Frank 34:55

No. Do I have to restart to update again? Oh, I do.

James 35:00

don't think so.

Frank 35:01

That's hilarious.

James 35:01

Oh.

Frank 35:02

I was too behind. ah One moment, please, James, while we restart to update.

James 35:05

Wow. Frank, you you must you must you must close your Code.

Frank 35:12

Oh boy, did we get background agents? I feel like, oh my God, there's so many options now. New chat, new chat editor, new chat window. Those are classic. New background agent, new clued agent, cloud. Sorry for my pronunciation.

James 35:26

Not Claude, but Claude.

Frank 35:27

New codex agent. Excuse me, who are you, codex? ah but I don't know.

James 35:32

OpenAI Codex.

Frank 35:33

I'm lousy with agents here, man. Which which agent do I want?

James 35:35

OK. So let me define what these agents are. Actually, Kyle, the CEO of GitHub, did a great video that we'll link to in the show notes on the VS Code one that breaks it down. You basically have three types of agents. You have local agents and you have cloud agents. Now, local agents can run in one of two ways. A local agent can be in the foreground, which is what we're used to. You type into a chat and it does stuff look yeah like in the foreground. You're waiting for it to complete, right? a back and Locally on your machine.

A background agent can work locally on your machine, but in the background. And it is just off doing a thing, kind of like a CLI that's hidden, if you will. In fact, it's powered by the CLI. Okay. You don't even have to the CLI it's included in the thing it's there. So that's pretty easy. So local and cloud local can be foreground can be background pretty easy. Now, the interesting part is that, um, the foreground and background agents can work on the branch that you're working on or another branch that you create or on a work tree. And they can even create a work tree so you can be working as well.

So what important about this is Frank could be working on something, a bug report comes in. He's like, oh my God. And then what he does, he says, let me create a new background agent. put it on a work tree, go and do it and fix the bug. And it goes off and does it. Now a cloud agent obviously is the third option. That is an agent that's running in the cloud completely asynchronously, not on your machine. That is a GitHub cloud agent, which I use all the time. Right.

And then codex is also a foreground local agent, but it's powered by open AI codex extension, but you're logging in through with your GitHub copilot subscription. So you don't have to have an open AI account to use codex, the extension, just use your sweet premium requests. You sign in with copilot, like, you know, you sign in with Twitter, you sign in with copilot and you use codex.

Frank 37:31

Okay.

James 37:38

So open AI bills, get hub, you, you pay GitHub. So it's one less subscription. Okay. So

Frank 37:47

You had me all the way up to Codex.

James 37:47

do

Frank 37:48

I totally don't get what the Codex one is, but fine.

James 37:50

So, so, so, so that one, you're not using the co-pilot UI you're using the codex UI. So the codex extension.

Frank 37:57

Oh, okay.

James 37:57

Yeah.

Frank 37:58

That makes a lot more. Okay. Oh, Sama. Always trying to reinvent the wheel.

James 38:02

Yep. You remember when Xamarin was both a company and a product.

Frank 38:03

Got it. but

James 38:06

Okay. Problem. So codex, both an extension and also the name and model. Very confusing.

Frank 38:13

Got it.

James 38:13

Yes.

Frank 38:14

Thank you.

James 38:14

Yeah.

Frank 38:15

Okay.

James 38:15

Very confusing.

Frank 38:15

I'm never going to touch that.

James 38:16

Okay.

Frank 38:17

Thank you.

James 38:17

new New background agent.

Frank 38:20

Let's do this.

James 38:21

Click it.

Frank 38:22

Okay. New background agent.

James 38:25

On the bottom, pick a model of your choice.

Frank 38:29

Uh, done?

James 38:32

Now, notice Codex, 5.1 Codex.

Frank 38:32

Can I pick codex? ha

James 38:37

I've been, I've been five, five X codexing now. Uh, notice that. So, so interestingly, those ones that are available, there are different than your main ones. Cause those are the models that are available in the GitHub copilot CLI, which powers background agents.

Frank 38:46

They are.

James 38:53

Okay.

Frank 38:54

Right, this is background. Right.

James 38:55

Yep.

Frank 38:55

And sorry, can you repeat one more time?

James 38:55

Background.

Frank 38:57

is background still local on my machine, though? So if I were to pull the plug on my machine, background's going to stop.

James 39:03

Yep. That is correct. That is correct. You have local and cloud and local can run in the foreground or in the background and cloud runs in the cloud. in ziclude Um, okay.

Frank 39:16

OK.

James 39:16

You picked a model. Notice the next, the next thing is work tree or workspace and work tree is the default.

Frank 39:18

Done. Work tree. Oh, God, why did they have to name them the same thing? Okay, fine. WorkTree, WorkSpace. Got it.

James 39:28

Workspace is your current workspace, basically whatever branch you have open. So you can say work sharing and say, let's update this. Read me with emoji. Why not?

Frank 39:41

I'm going to add more emoji to my autopilot rudder control system, which it really does not need emoji.

James 39:48

Perfect.

Frank 39:50

But James, that is your example. That's what I'm doing.

James 39:54

Fire it off.

Frank 39:55

Created isolated work tree. Oh, God, another work tree.

James 40:00

So now you have a work tree called work tree 2025 dash 12 dash whatever.

Frank 40:04

yeah It's true. It's true, I do.

James 40:06

Yeah. It's in the future.

Frank 40:07

Where is it, though?

James 40:07

Cause it's UTC.

Frank 40:07

Because I'm still on my James.

James 40:08

Yep.

Frank 40:09

Oh, no. i'm know where I am, James. where Where am I? Where am I? um i am going back to my main thing. OK, there is indeed a new work tree.

James 40:21

yep So if you, now, when you go to your source tree, you'll have the James work tree and the work tree with a super long name, and then you can check out that work tree branch.

Frank 40:21

Name that. Which it also created branch with that same long name.

James 40:31

Yeah.

Frank 40:32

So it seems like work trees and branches, they're really kind of merging them a lot. But yeah, it's cool.

James 40:36

Yeah, I feel like the, think what's nice is really like, Hey, I'm in the James work tree and James is the default branch.

Frank 40:36

It's cool.

James 40:44

That's kind of what it is.

Frank 40:44

her

James 40:46

I think that way it's like main and master like aren't this the same basically.

Frank 40:49

Oh, fascinating.

James 40:49

Yeah.

Frank 40:50

Even though I created a background, though, it doesn't want me to close the window. Fascinating.

James 40:54

Oh, you can, it'd be fine. It'll just like warn you. It's fine. It'll just keep doing it.

Frank 40:57

Oh, it's complaining, but you're saying it's fine, huh? It says the chat request will stop if you close the window.

James 41:02

I think it's going to be okay.

Frank 41:05

I'm not doing it. Too risky.

James 41:06

Yeah.

Frank 41:07

Bold move, Cotton.

James 41:07

Well, you can hit the little back arrow. You you can hit the little back arrow and and it'll show you all of your sessions now.

Frank 41:15

Back arrow? What back arrow are you talking about?

James 41:16

Yeah. and Inside your chat agents. See there's a little back arrow in the chat up top.

Frank 41:24

Nope.

James 41:25

Under chat, under the word chat, there's a little back arrow.

Frank 41:29

Is there...

James 41:31

my Mine, mine already was already done. It was know time at all.

Frank 41:34

Yeah, you have a good internet. um Yes, you are right. There indeed was a back arrow. A left-leaning arrow, as we like to say.

James 41:40

So you can go back to all of your session. Now you can go back to all of your sessions. You can see all of your sessions that are there.

Frank 41:46

Okay, yeah.

James 41:47

Okay. Now here's, what's interesting. So let's say you're in just a local chat and now.

Frank 41:51

Oh, James, what is it? It's added so many emojis.

James 41:55

Good as it should have.

Frank 41:55

This is all your fault.

James 41:57

Yeah. So you can actually like, well, here's, what's cool is like, you can actually go in and you can view the diff and all this stuff that's there and, and see everything, you know, no matter where you're at, basically. Yeah.

Frank 42:09

Oh my goodness. James, there's emojis everywhere.

James 42:11

All the emoji. Yeah.

Frank 42:13

What did you do?

James 42:14

Good.

Frank 42:14

what that That was the worst example you could have possibly thought of.

James 42:14

Good. You're, you're in the work tree. You're in the work tree. Okay. You're in the work tree. It's fine.

Frank 42:21

Oh no, I'm committing right now. Upload, push.

James 42:23

Okay. So the cool thing is, is that you can do a few things, Frank, so you can obviously keep working on that background one. That's there. Now let's say you're in a normal chat.

Frank 42:34

Yeah.

James 42:35

So let's say just create a new chat, new, new chat, go up there. New chat.

Frank 42:39

You are a gutsy gutsy guy.

James 42:42

It's new chat.

Frank 42:42

New chat.

James 42:42

They're all, they're all fine. It's all running.

Frank 42:44

In my work tree, in my main window, in my James.

James 42:44

Okay. In your main window.

Frank 42:47

Like, I have so many copies of my code now.

James 42:50

Doesn't matter anywhere.

Frank 42:52

OK.

James 42:53

You're you're yeah.

Frank 42:54

um I'm here, babe.

James 42:55

So then you have a chat box down there, right?

Frank 42:58

Mm-hmm.

James 42:58

So you could say at CLI or at cloud. Right.

Frank 43:01

OK.

James 43:04

And then you could, you could delegate something there.

Frank 43:04

Yep.

James 43:06

But you could also type type something and you could say, you know, do something else. Right. And then notice that you have a agent, you have a model, you have tools, you might have a microphone. You have now kind of two send buttons. Yeah. There's like two send buttons down there on the right. little funky.

Frank 43:23

Kind of is, yeah. one One's a continue chat in and there's a send.

James 43:24

Yeah. Yeah. Ascend.

Frank 43:29

Yeah.

James 43:29

So do the continue chat in.

Frank 43:32

Oh, boy.

James 43:32

This is a few things that are interesting here is you might be working and have a bunch of files that are like checked out already that you've been working on.

Frank 43:35

Hmm.

James 43:41

You're like, you know what? i don't got time to finish this. You might want to delegate to the cloud or work in the background. You can take anything in a current chat session or just a new status, Jessen, and just say, continue in and say background. And it will take all of your current changes, move them into a new background work tree, and just get to work on your behalf automatically or move it to the cloud.

Frank 44:00

Can I tell you why I like this, James?

James 44:02

Why do you like this, Frank?

Frank 44:04

Because i have had been having one of those bad internet days where it feels like every every um every chat I try to have with the AI, it's like network error. And then you might try something else. Network error. Network error. Network error. I'm having a bad internet day. So I feel like if if I had done update to restart, restart to update earlier, i might have discovered that I could just move the whole gosh darn thing up into the canood and just have it go there. Because I'm assuming in the clouds, the internet is always good up in the cloud. So I kind of wish you had told me about this about five hours ago.

Because I'm going to use the heck out of this whenever I'm having a bad internet day. I am going straight to the canood.

James 44:50

Good. Yeah. that ah that

Frank 44:51

Is that what it's for? Am I using it wrong?

James 44:53

No, that's correct. Yeah. I mean, I use, I use, uh, so something I do for cloud agents specifically is, I have to get a mobile app on my phone.

Frank 44:55

right Right.

James 45:05

I just open my, my repo and I can, there's a new task for the cloud agent and you just tell it what you want it to do.

Frank 45:10

Yeah.

James 45:11

And it just goes and creates a pull request for you, opens it up and then just goes to town and works off whatever branch you want it to do. Right. Boom. Just does it.

Frank 45:19

Right. Yeah.

James 45:20

Um, so one thing I do at the end of the day, every day is I assign something to copilot. I just give it to it. So I go into VS code, i either spin up a new task for it to do, or I go on to get up.com or my mobile app, spin it up.

Frank 45:26

no

James 45:31

And often before I go to bed, I also do that. So I'm always just spinning up stuff automatically.

Frank 45:34

Nice. Yeah.

James 45:37

just because I can, why not? Um, yeah. Or like in this case, you can just say, you know what?

Frank 45:40

But I like...

James 45:43

I have this feature. don't know, whatever, spin it up, put in the background, let the cloud take, take it and handle it later and just go to town.

Frank 45:50

Yeah. Yeah.

James 45:50

It does, it takes more time, right? Cause it has time to do stuff, but the results are pretty better. Hmm.

Frank 45:55

So I know we're mostly talking about work trees. So I'll ask the obvious question. When I do a cloud one, is it by default going to do a work tree stuff? Or no, that's pretty explicit, I have to say. In that second dropdown, as you explained earlier, you have to choose work tree when doing a background one or whatever.

James 46:10

For, for clouds, you can actually spin up a new cloud agent specifically, and there's actually no selections in there. So you are just giving it to it.

Frank 46:17

Right.

James 46:18

It will work off the current branch that you're on.

Frank 46:22

OK, fair enough.

James 46:23

Yeah.

Frank 46:23

Yep.

James 46:24

So if you're on main, it'll be off of main.

Frank 46:24

so So if I do a cloud one, it will eventually synchronize with the editor at some point then.

James 46:30

Just a branch it creates a branch.

Frank 46:33

Mm-hmm.

James 46:34

It will. Okay. So just go in to your main and just say, Hey, update the read me with a bunch of emoji and fire it off to the cloud agent.

Frank 46:41

Oh, man. No, not more emoji, James. No.

James 46:44

Yeah. Do it.

Frank 46:45

Those poor repos are already in such trashed state.

James 46:48

It they're all in branches and work trees.

Frank 46:49

It's so trashed.

James 46:50

They're all throwaways.

Frank 46:52

I care a lot about my code.

James 46:54

I'll burn a premium request.

Frank 46:54

All right.

James 46:55

Let's do it. Come on.

Frank 46:56

All right, I'm doing it I'm doing it I'm doing it.

James 46:58

Yep. Yep.

Frank 46:59

I'm trying to find my readme because I have so many junk files in here.

James 47:01

No, you don't even need to tell it. Just tell it. Tell it to update the README.

Frank 47:03

OK, please, please update my readme.

James 47:04

Just tell it. It knows. It'll find it. That's sweet emoji.

Frank 47:10

Readme with sweet emoji.

James 47:15

Yep. Fire it off to the cloud, baby. You don't you don't need to. That's going to spin up on entire environment.

Frank 47:20

What tree is it going to work in? Which work tree? Which branch? Who knows? Let's just go. okay it's actually going to ask me.

James 47:25

Yep.

Frank 47:26

Delegate to the cloud. Cloud agent. Blah, blah, blah. um This workspace has uncommitted changes. should Speak of the devil. Should these changes be pushed and included in the cloud agent's work? No, it should not.

James 47:39

No.

Frank 47:41

And my options are commit changes and delegate. Delegate or cancel. just going hit delegate.

James 47:47

Delegate it.

Frank 47:48

ah ah Repo base branch is not detected on remote. That's because this isn't up on a remote. Okay, fair enough.

James 47:56

Yes.

Frank 47:56

So you want to be, you actually have to be synced to a remote to use the clued.

James 47:58

On your main. Yes.

Frank 48:03

That makes sense.

James 48:03

Okay. So go to your main and then just tell to go do the same thing.

Frank 48:07

Sure, fine.

James 48:09

We got to do it in real time, Frank.

Frank 48:09

my My poor source code. It's never going to survive any of this.

James 48:14

It'll be fine. You don't need to merge it into Maine. Fine.

Frank 48:18

You just assume that I push everything up to the cloud. i get i get without the cloud sometimes, you know. That's how I roll. Please add some sweet emojis to my readme.

James 48:31

I hope it's all sweet, like treats and stuff like that. You know what i mean?

Frank 48:34

Oh, God, it is going to do that, isn't it?

James 48:36

I think so.

Frank 48:36

Well, too late now. i hit enter.

James 48:39

God.

Frank 48:41

It's creating a pull request. Okay, so that's the that's the world we're living in.

James 48:43

It is.

Frank 48:45

Got it.

James 48:45

Yeah, so when you do a cloud agent, it's going to create a new branch off of your branch that you're on. And like you said, you were on the work street before, which wasn't pushed up to the cloud, so it doesn't know what to do. It maybe should fail faster, in my personal opinion, but probably whatever the APIs are calling is there. So there's there's this that you can go and do. Now, inside of VS Code, under your all sessions, you should now see a new item, and and you'll see that it says cloud.

Like you see background and cloud and local, you see those items there.

Frank 49:18

Um, it does, yes. Okay, yes. Cloud, right. Okay.

James 49:21

And you can, you, and you can, you can click on it and it will open and tell you what it's doing.

Frank 49:22

Session is initializing. Okay. Cloud Agent has begun work. It's on a coffee break at the moment, and it's demanding rights, but yeah, okay.

James 49:37

Yeah. It's going to spin up and do some stuff. Yeah.

Frank 49:39

No, it's cool.

James 49:39

So now if you, if you go, yeah.

Frank 49:40

It's working. The poor thing is, oh, it created a plan to add emojis to readme.

James 49:41

And then, yeah.

Frank 49:45

I feel, I'm sorry.

James 49:46

It did.

Frank 49:47

I'm sorry. I feel like I need to apologize to it.

James 49:50

Now you can just stop it too if you really want to. Don't do it, but don't and don't do it. It's actually, here's what's really fascinating about what you just did, Frank, is you actually spun up an entire Linux environment where your code was cloned and is now running a GitHub action where I believe that you are the sole cause.

Frank 50:03

Oh gosh, the poor thing. Did I just cause global warming, James? Did I do that?

James 50:12

That is correct, yeah. Yeah.

Frank 50:15

I'm so sorry, Mother Nature. James made me do it.

James 50:17

So, So why is this important? This is important because you now have many, many ways of working with agents based on the type of work you need to do. You may not need to use background agents ever, but I find them pretty nifty and pretty fast to do certain things, especially experimenting. One of the things that you might think of doing is, you know what? I have this chart. Let's say you're creating a weight tracking application. You have a chart. And you're like, you know what I really want is five different variants or five different styles or five different things.

Frank 50:51

yeah.

James 50:52

You could say, go create five branches and five or five work trees to go to this and spin it up. So you spin up five different, you know, background agents that are just getting to work on your local machine, right? Um, this is really cool because we've talked about running two foreground local agents before in different parts of the code and that's okay too. Um, but now you can have multiple background agents doing different things.

And they could be experiments, they could be different different variants, or they could just be different pieces of functionality. You could say, you know what, I want this background agent to go spin up all the back of the APIs, and I'm gonna work on the foreground over here um you know and and do this here. gonna do the mock ones here, or do whatever, and just kind of spin it up. Like you said, work on a bug fix over here and do a feature while it's going. Or more importantly, maybe you're working on a bug and you have an idea for a feature, spin up a new background agent, let's let it get to work. right so

Frank 51:45

Yeah.

James 51:45

And just like commits are free, pull requests are free and also work trees are free. So everything's free and you can just throw them right away if you don't want that. So, um, I, and I, and I was just talking to John Lindquist at this AI dev days, and he was talking about critical thinking about how we use these different tools and how we use the CLI. And i was talking about these charts and he's like, you know what? He's like.

You know, maybe you don't know how to display it, but tell it to come up with 10 unique ways and different styles and different charts and be creative with the data. He's like, you know what? Just tell it to create all 10 charts, put them on the screen, display all the data, and then let you pick about them. And then you refactor the code and throw it away. Right. It's like, you have the idea of like.

Frank 52:24

you

James 52:26

Different critical ways of thinking with these models that just telling it to do stuff, tell it to come up with different things and display different data and create different. Work trees and you work in the background and different things all the same time. So. Work trees are a core piece of functionality anyone can use, but in integration, especially with background it you know to tasks and agents, it's really fundamental there as well. So that's why it's kind of good to know. I think that the VS Code team or the GitHub team, I've talked to both of them, will put out a very good like video on like what GitHub work trees are that don't take 53 minutes to describe. But I know that Primogen did a video like five years ago on Git work trees.

And I think it was good, but it didn't really, you know, that was pre AI. So it's kind of like, cool. Get workers are cool. Why would I use this, you know, type of thing. And then now we have like, not just why would I use it? But the tooling is literally helping you create them, use them, spin them up automatically. Like seeing the background agent create that work tree for you automatically. to think about it. Boom. It's right there in the UI.

Boom. You can bring those over. You can merge it back in bingo bango. You're good to go. So yeah.

Frank 53:33

Yeah, I've said a lot of things about it all. I'm not going to take any of it back. um I'm not sure if I will use the work trees myself too much, except for in those critical situations, but I can totally see myself using background agents and thus work trees just to keep it all organized.

James 53:49

Yeah. It's right there.

Frank 53:50

So I totally see that use case. But I really appreciate the cloud one too, because unlike you, I don't always think to go first into GitHub to do these kinds of things. So it's nice to just remember that it's it's sitting there behind the little chevron next to the plus sign. And I can always get a cloud one up.

James 54:09

there

Frank 54:10

I'm never touching the codex one. I have no idea what that is. um James, I want to report back. This is very important. um It did not put only candy and sweet themed emojis into my readme.

James 54:22

Wow.

Frank 54:23

It did flood my readme with emojis, but they are of all sorts, not just candy related. So I'm not sure if it followed my directions explicitly. But I think it understood the gist of what we needed there. So um honestly, i was going to revert this change. I think I might just keep it. There's a lot of emojis.

James 54:45

Means you're doing something right. So yeah.

Frank 54:47

ah Terrible. Absolutely terrible.

James 54:49

Yeah. Yeah.

Frank 54:51

These are cool features. I'm really glad you introduced them to me, and I can't believe it took me 10 years to learn what sounds like a pretty major Git feature. So thank you for the intro to Git lesson today also.

James 55:03

You are very welcome. I'm glad I could teach you something, but I also just found out about them this year. So no shade on anyone that's just learning about work trees for the first time. However, because of this new VS code release and background and these things going in there, I think there is a pretty nice, large education to be had on them. And don't even know if I did the best job.

Frank 55:21

Mm-hmm.

James 55:22

So let us know if we got this right, wrongly comments on youtube.com. At merge conflict FM. That is us. If you're there, then you're already watching us. so you should definitely subscribe. Like, if you're listening, you can also do that because you're probably also listening to your podcast app. So make sure you also hit that subscribe button and share with your friends and coworkers. That's to it for this week's Merge Conflict. Let's go ahead and get our work tree spinning. So until next time, I'm James Montemagno.

Frank 55:48

And I'm Frank Kruger. Thanks for watching and listening.

James 55:52

Peace.

Download Transcript

Episode Comments