WEBVTT
00:00:05.759 -->
00:00:09.119Welcome to another episode of Runtime Arguments.
00:00:09.119 -->
00:00:14.640Uh I'm Jim McQuillen, and today, like always, is my best friend Wolf.
00:00:14.640 -->
00:00:15.839Say hello, Wolf.
00:00:16.399 -->
00:00:17.600Hey everybody.
00:00:18.320 -->
00:00:19.760So how was your week?
00:00:19.760 -->
00:00:22.320I think you got some interesting news to tell us.
00:00:22.879 -->
00:00:24.559Uh I had a good week.
00:00:24.559 -->
00:00:45.920Um I think the high point of my week was that um I think uh last episode we talked about uh editor theme uh syntax coloring scheme that I like called Alabaster, designed by uh a guy who goes by the name uh the handle Tonsky.
00:00:45.920 -->
00:00:47.920Uh lots of other editors.
00:00:47.920 -->
00:00:51.200Uh all I did was port it to Helix.
00:00:51.200 -->
00:00:58.320Um it was in my dot files, I turned it into its own repo, I got feedback from outside.
00:00:58.320 -->
00:01:02.399People generally liked it, and they were incredibly useful suggestions.
00:01:02.399 -->
00:01:15.840I made screenshots, I did updates, I copied those theme files into a brand new branch of a fork of Helix and did a pull request.
00:01:15.840 -->
00:01:25.200And in the time since me talking about it last episode and now, that pull request has been accepted.
00:01:25.200 -->
00:01:32.560So my ports of Alabaster theme um are now in Helix Maine.
00:01:32.560 -->
00:01:40.000How long it actually takes for Maine to uh turn into a production build, that I don't know, I'm sorry to say.
00:01:40.000 -->
00:01:41.280But pretty happy.
00:01:41.599 -->
00:01:43.280But that's pretty cool.
00:01:43.280 -->
00:01:45.120It really is.
00:01:45.120 -->
00:01:50.239And um we're gonna talk about pull requests a little bit today uh as part of our topic.
00:01:50.239 -->
00:01:52.000Uh we'll get into that in just a minute.
00:01:52.000 -->
00:01:54.239In fact, let me let me say what our topic is.
00:01:54.239 -->
00:01:58.719We're talking about git, uh, some of the superpowers with Git.
00:01:58.719 -->
00:02:00.239A lot of people are using Git.
00:02:00.239 -->
00:02:04.159A lot of people are just barely using Git, uh, kind of like me.
00:02:04.159 -->
00:02:08.000And uh Wolf is gonna tell us all kinds of cool things you can do with Git.
00:02:08.000 -->
00:02:11.919That some of them are advanced, some of them are things we all should be doing.
00:02:11.919 -->
00:02:16.479Uh, but before we get into that, I've had a pretty good couple of weeks.
00:02:16.479 -->
00:02:22.000Uh I talked last time about how I moved my database, my production database.
00:02:22.000 -->
00:02:23.919Uh, I took it out of Azure.
00:02:23.919 -->
00:02:32.800It was uh hosted by Azure, uh managed by Azure, and I I took over hosting of my database in the VM that I have on Azure.
00:02:32.800 -->
00:02:38.800So it's not Azure managed Postgres, it's gym-managed Postgres.
00:02:38.800 -->
00:02:41.520Um I did that for all kinds of reasons.
00:02:41.520 -->
00:02:44.879Uh if you go back to the last last episode, I talk about that.
00:02:44.879 -->
00:02:47.840Um uh but the customer loves it.
00:02:47.840 -->
00:02:50.719The performance is about double what it used to be, which is great.
00:02:50.719 -->
00:02:52.240Uh, it's so much more flexible.
00:02:52.240 -->
00:02:53.199I'm loving that.
00:02:53.199 -->
00:02:56.639But something else I'm doing, and this is really gonna excite Wolf, I think.
00:02:56.639 -->
00:02:58.719I haven't told him anything about this yet.
00:02:58.719 -->
00:03:03.360But I created an account on Claude and I downloaded.
00:03:03.360 -->
00:03:04.960I did.
00:03:04.960 -->
00:03:12.319I downloaded uh Claude code, and um, you know, I avoided AI for a long time.
00:03:12.319 -->
00:03:17.439Uh, and I've got reasons or excuses, whatever you want to call it, why I avoided it.
00:03:17.439 -->
00:03:19.919Um, you know, I enjoy programming so much.
00:03:19.919 -->
00:03:28.719Part of what I enjoy, or or maybe the big thing for me, is the endorphin release that I get when I solve a problem.
00:03:28.719 -->
00:03:35.520I I tinker with programming and I figure something out, and when it works, it's like euphoria for me.
00:03:35.520 -->
00:03:37.039I I don't know if everybody gets this.
00:03:37.039 -->
00:03:38.719I think Wolf probably does.
00:03:38.719 -->
00:03:49.439Uh, but you know, when you work on something and you get it working, you know, and you maybe struggled for a while, there's just something about that that is so pleasurable for me.
00:03:49.439 -->
00:03:54.240Um, it's it's kind of like uh there's other things in my life that do that too.
00:03:54.240 -->
00:03:56.159I used to play blackjack a lot.
00:03:56.159 -->
00:04:00.000And uh maybe I played too much, but I did pretty well at it.
00:04:00.000 -->
00:04:04.639I won some money, I had a lot of fun, I lost a little bit of money, but overall I'm I'm up.
00:04:04.639 -->
00:04:08.240Um uh and I haven't played in a couple of years, really since COVID.
00:04:08.240 -->
00:04:12.080I haven't played, but I love playing blackjack because I love the numbers.
00:04:12.080 -->
00:04:18.639I love adding up to 21, finding some combination of numbers that that equals 21 or close to 21.
00:04:18.639 -->
00:04:21.680And I hope it go I hope it's a better score than the dealer has.
00:04:21.680 -->
00:04:25.199And that just that releases the same kind of endorphins for me.
00:04:25.199 -->
00:04:34.560Um playing uh uh jigsaw puzzles, and I know Wolf, you've you you've kind of uh kitted me a little bit about why do I like jigsaw puzzles, but it's the same kind of thing.
00:04:34.560 -->
00:04:44.240When I figure out a jigsaw puzzle, when I finish it, I I get this little shot of of uh uh of euphoria, and it's just great.
00:04:44.240 -->
00:04:48.480Um we play some other games like when we go to Maine, a bunch of us go to Maine.
00:04:48.480 -->
00:04:54.720We play Mexican train, and you guys probably think uh we must be a bunch of old people living in Florida.
00:04:54.720 -->
00:04:56.800But I I love it because it's numbers.
00:04:56.800 -->
00:05:01.360You know, you're you're stringing dominoes together in long strings and solving a problem.
00:05:01.360 -->
00:05:03.279And I just I just love that.
00:05:03.279 -->
00:05:09.439So I've been afraid that going with AI, I was gonna miss that.
00:05:09.439 -->
00:05:17.040Uh if I let AI generate my code for me, I uh and uh now that I'm sort of getting into it a little bit, I realize that's just ridiculous.
00:05:17.040 -->
00:05:20.560Um I'm still involved, I'm still driving the car.
00:05:20.560 -->
00:05:30.639Um the one of the problems I've had though, uh keeping me from AI is I like understanding how my tools work.
00:05:30.639 -->
00:05:31.360Right?
00:05:31.360 -->
00:05:33.439I I know how compilers work.
00:05:33.439 -->
00:05:41.759I've written compilers, I've worked on compilers, I know deep down really how they work, how the parsing works and the lexical analysis and all that stuff.
00:05:41.759 -->
00:05:43.839I've got a pretty good understanding of that.
00:05:43.839 -->
00:05:48.079Um I I know how network stacks work, uh, I know how mobile apps work.
00:05:48.079 -->
00:05:51.920I've written some of those, and it's not really rocket science how all that stuff works.
00:05:51.920 -->
00:06:04.720And I know, uh Wolf, you've worked on browsers, you know, you know intimately how Mozilla uh Firefox works because you were uh uh an engineer way back in the day in the in the 90s.
00:06:04.720 -->
00:06:08.720So you know what it's like to work on things that you understand how they work.
00:06:08.720 -->
00:06:11.759AI, I don't have a clue how it works.
00:06:11.759 -->
00:06:18.560You know, people throw out things like, well, yes, just this graph that that you're traversing and stuff, and that means nothing to me.
00:06:18.560 -->
00:06:21.439And I think it probably means nothing to almost everybody.
00:06:21.439 -->
00:06:27.839There's probably a very few uh number of people who really understand how these models work.
00:06:27.839 -->
00:06:32.240Um and uh that turns me off a little bit.
00:06:32.240 -->
00:06:41.600Um I'm kind of not excited about that part of it, but uh I am I am looking forward to the help it can give me.
00:06:41.600 -->
00:06:49.439Um I I've I've uh uh there's other reasons why I've avoided it too.
00:06:49.439 -->
00:06:59.839I'm a little concerned about the plagiarism aspect of AI, um, but Wolf assures me that uh Claude is using licensed uh data for their models.
00:07:00.079 -->
00:07:04.480And I I I think in this case according to their their messaging.
00:07:04.879 -->
00:07:06.639Yeah, and I hope that's true.
00:07:06.639 -->
00:07:10.319And I think at this point, I'm going with plausible deniability.
00:07:10.319 -->
00:07:18.000I'm gonna jump into Claude and if they say it's legit, uh, I'm I'm gonna have to go with it because you know what?
00:07:18.000 -->
00:07:23.199So many of my friends are using it, so many of the smartest people in the world are using it.
00:07:23.199 -->
00:07:25.360Wolf is at the top of that list.
00:07:25.360 -->
00:07:29.360Marlon is telling me I really have to be using uh AI.
00:07:29.360 -->
00:07:31.120He's telling me how he's using it.
00:07:31.120 -->
00:07:32.959Uh Justin is using it.
00:07:32.959 -->
00:07:34.879Lots of our friends are using it.
00:07:34.879 -->
00:07:37.600So I've decided I'm jumping in.
00:07:37.600 -->
00:07:39.279I I installed it yesterday.
00:07:39.279 -->
00:07:40.879I'm completely lost.
00:07:40.879 -->
00:07:43.439I'm gonna be looking for help from you, Wolf.
00:07:43.439 -->
00:07:47.680Um, but uh I'm I'm not gonna get left behind.
00:07:47.680 -->
00:07:49.519I I am gonna give it a try.
00:07:49.680 -->
00:07:55.600Uh so I'm super happy that you have decided this is a journey worth exploring.
00:07:55.600 -->
00:07:56.240Yeah.
00:07:56.800 -->
00:07:57.120Yeah.
00:07:57.120 -->
00:08:05.360You know, I I've got a couple of uh iOS, a little pet projects I've been wanting to start for like two years, and I've just not found the time to do it.
00:08:05.360 -->
00:08:08.800And I'm kind of thinking this is a great way to get started.
00:08:08.800 -->
00:08:15.759I'll integrate it with Xcode and and see if I can generate a lot of the boilerplate stuff for these little apps.
00:08:15.759 -->
00:08:27.600There's nothing complex that I'm doing, but it's it's a lot of mundane stuff, and I'm kind of thinking that uh Claude Code is going to be my uh my my pair programmer uh to help me out here.
00:08:28.000 -->
00:08:34.799Yeah, for for me, um using Claude Code is about reducing friction.
00:08:34.799 -->
00:08:50.559Um it's not about Claude writing new code for me, because uh I do let it uh generate code for tests and things, but everything that it does, I'm very careful to look at and understand.
00:08:50.559 -->
00:08:58.960Um for the most part, for real code, for stuff that does your thing, i it's like working with a very junior programmer.
00:08:58.960 -->
00:09:05.440I'm not happy with the kind of code Claude would give me when I let it give me code.
00:09:05.440 -->
00:09:12.799But once I tell Claude exactly what I want, then it's like a really good editor.
00:09:12.799 -->
00:09:20.559Like it can take that change and apply it in the 13 places that you need it in this directory, for instance.
00:09:20.559 -->
00:09:24.399It can um decide which files need to be added.
00:09:24.399 -->
00:09:30.159It's great at making a useful commit message, which is nothing but drudgery for me.
00:09:30.159 -->
00:09:33.759I've got it hooked up to our ticketing system.
00:09:33.759 -->
00:09:34.639We use Jira.
00:09:34.639 -->
00:09:46.159Uh, so it makes sure to keep my tickets up to date, to know my priorities from the tickets, to move the tickets from one column to the next.
00:09:46.159 -->
00:09:51.519This one is in the backlog, now it's in progress, now it's moved to PR.
00:09:51.519 -->
00:09:52.799Oh, it's done.
00:09:52.799 -->
00:09:56.960Um, and it just keeps track, which is the thing I'm bad at by myself.
00:09:56.960 -->
00:10:04.799That's a growth area for me, and it's a place where I need to be communicating with the rest of my team and my boss.
00:10:04.799 -->
00:10:08.960Uh, they need to see my progress by seeing those tickets.
00:10:08.960 -->
00:10:14.879Having Claude do that uh makes me set expectations better.
00:10:14.879 -->
00:10:16.639It was drudgery.
00:10:16.639 -->
00:10:21.840Uh and nobody would look at that use of Claude and say, oh, you're cheating.
00:10:21.840 -->
00:10:24.000You're you're letting Claude do all the hard.
00:10:24.000 -->
00:10:24.559No.
00:10:24.559 -->
00:10:28.080It's it's reducing friction, that's all.
00:10:28.080 -->
00:10:34.639I I do want to slip in one thing before we let it go.
00:10:34.639 -->
00:10:39.360Um, and that is uh with respect to blackjack.
00:10:39.360 -->
00:10:40.639Yes.
00:10:40.639 -->
00:11:01.440So um if you go in with the mindset, I'm gonna have some fun with uh eight hundred dollars or two thousand dollars or whatever, and you don't care whether you come out with zero or twenty thousand, I support you a hundred percent.
00:11:01.440 -->
00:11:16.480If you decide that blackjack is your profession and your intent is to make money, uh just like you know, there are people who play the lottery this way, um there it's a tax.
00:11:16.480 -->
00:11:22.879Uh gambling is not uh a thing that you mathematicians don't gamble.
00:11:22.879 -->
00:11:28.159Um and the reason is because of a thing called gambler's ruin.
00:11:28.159 -->
00:11:31.200And the the it's not about odds.
00:11:31.200 -->
00:11:37.600It's about the fact that the casino has enough money that they last longer.
00:11:37.600 -->
00:11:49.840Uh in real uh sequences of wins and loses uh that that are true, there's gonna be long runs of wins or long runs of losses.
00:11:50.080 -->
00:11:50.320Sure.
00:11:50.480 -->
00:11:59.440And the fact is, the casino has enough money that you could l or they could lose for days and still keep going.
00:11:59.440 -->
00:11:59.840Yeah.
00:11:59.840 -->
00:12:01.919Uh you can't.
00:12:01.919 -->
00:12:07.360So even well, no matter what the odds are, gamblers ruin can can cut your winning short.
00:12:07.679 -->
00:12:07.840Sure.
00:12:07.840 -->
00:12:08.240Sure.
00:12:08.240 -->
00:12:09.600And for me, it was about the fun.
00:12:09.600 -->
00:12:14.559It was never uh a way to make money, because believe me, you uh I I wasn't that good.
00:12:14.559 -->
00:12:18.879I don't know if anybody's really that good at blackjack that they can consistently make money.
00:12:18.879 -->
00:12:26.799But it was uh it was the the the rush, the adrenaline or the endorphins of uh solving problems that I just love.
00:12:26.799 -->
00:12:28.480Absolutely behind you.
00:12:28.480 -->
00:12:37.200And I also my rule was always if I come home with enough money in my pocket to get my car out of the parking lot, I've done all right.
00:12:37.200 -->
00:12:42.080And I never I I never gambled all that much.
00:12:42.080 -->
00:12:45.279I hear you uh money-wise, but it was just the fun.
00:12:45.279 -->
00:12:47.519And you know, eventually I got tired of it.
00:12:47.519 -->
00:12:52.080I I thought I could, you know, there's other ways I can I can get these uh endorphins.
00:12:52.080 -->
00:12:54.320Uh but yeah, yeah.
00:12:54.320 -->
00:13:06.559So I hear you about the gambling, and like I said, I haven't I haven't played blackjack in six years, and I don't have any plans uh on the future uh to do that, but uh I I I do enjoy it.
00:13:06.720 -->
00:13:11.759Um as for Claude, uh before you go on, I'll just say one quick thing.
00:13:11.759 -->
00:13:19.840Claude takes direction in the same way that git uh sort of stacks up.gitignore files.
00:13:19.840 -->
00:13:20.240Yeah.
00:13:20.240 -->
00:13:23.919Uh Claude Claude uses Claude.md files.
00:13:23.919 -->
00:13:30.559So there's one uh in your home directory uh inside.claude.
00:13:30.559 -->
00:13:32.480There's one in your project.
00:13:32.480 -->
00:13:35.120It'll find anything above your project.
00:13:35.120 -->
00:13:41.360Um so my root Claude.md file is public.
00:13:41.360 -->
00:13:43.519It's in my dot files.
00:13:43.519 -->
00:13:45.360I I need to go get that.
00:13:46.159 -->
00:13:49.120Um yeah, there are things in there that might be useful.
00:13:49.120 -->
00:13:52.240And uh, you know, we did a whole episode on AI.
00:13:52.240 -->
00:13:54.080Uh it was episode eight.
00:13:54.080 -->
00:13:57.039That was uh today is what, episode 20.
00:13:57.039 -->
00:14:01.039So that was quite a while ago, um, three or four months ago.
00:14:01.039 -->
00:14:02.480So go back and listen to that.
00:14:02.480 -->
00:14:05.360I think that was before you were really using cloud code.
00:14:05.360 -->
00:14:10.799Uh I think that was uh maybe you were starting to use it, but now I think you've got a lot more experience with it.
00:14:10.799 -->
00:14:18.960And maybe we'll do another episode sometime in the future, uh, getting a little more in-depth in how we use uh cloud code and AI uh for what we do.
00:14:18.960 -->
00:14:22.480But let's get on to the feedback from previous episodes.
00:14:22.480 -->
00:14:26.159Uh the last episode, uh, 19 was about data centers.
00:14:26.159 -->
00:14:28.320And uh that was a fun episode.
00:14:28.320 -->
00:14:32.080We got a lot of feedback on that, and it and a lot of people uh really enjoyed it.
00:14:32.080 -->
00:14:37.200Uh, there's a couple of points I made that maybe weren't exactly accurate.
00:14:37.200 -->
00:14:44.080Uh one of them was uh I you know I mentioned um uh uh 1U servers in Iraq.
00:14:44.080 -->
00:14:46.080I had said it's uh an inch and a half.
00:14:46.080 -->
00:14:48.159Uh no, it's an inch and three quarters.
00:14:48.159 -->
00:14:54.639So uh uh a C a server in Iraq, a one U server takes an inch and three quarters.
00:14:54.639 -->
00:14:59.120You can fit at most 42 of those in a standard rack.
00:14:59.120 -->
00:15:05.519Most people put no more than 38 because they need room for a network switch and a little bit of cooling space in there.
00:15:05.519 -->
00:15:07.279Uh so that was that one little thing.
00:15:07.279 -->
00:15:10.000And Wolf had asked a question during that episode.
00:15:10.000 -->
00:15:18.159Uh, when I was talking about 1.4 gigawatts, uh the the data center was spec'd out at 1.4 gigawatts.
00:15:18.159 -->
00:15:22.559Um he had asked, is that gigawatt hours?
00:15:22.559 -->
00:15:24.159Well, no.
00:15:24.159 -->
00:15:31.120Uh the the spec on that is that's the most current it can draw at any given instant.
00:15:31.120 -->
00:15:35.039Um for instance, my house is a 200-amp service.
00:15:35.039 -->
00:15:41.279That means the the the size of the wires coming into my house can deliver up to 200 amps.
00:15:41.279 -->
00:15:44.799Uh at 240 volts, that's 48,000 watts.
00:15:44.799 -->
00:15:47.600So that's 48k watts.
00:15:47.600 -->
00:15:51.440Uh a data center is 1.4 gigawatts.
00:15:51.440 -->
00:16:00.480It's you know, it's a couple of orders of magnitude larger than than, you know, several orders of magnitude larger than what my house uh will draw.
00:16:00.480 -->
00:16:04.559But that's that that says nothing about per hour.
00:16:04.559 -->
00:16:08.320That's just uh how much current that thing can draw.
00:16:08.320 -->
00:16:15.360Uh when you start talking about gigawatt hours or kilowatt hours like you see on your electric bill, that's just the electric company charging you for it.
00:16:15.360 -->
00:16:22.879They charge you for how many hours of uh uh kilowatt you use.
00:16:22.879 -->
00:16:29.279And you know, you might see your electric bill and it might say you're you know 300 kilowatts or 500 kilowatts for the month.
00:16:29.279 -->
00:16:30.000Uh, that's all.
00:16:30.000 -->
00:16:34.480The the kilowatt hours, that's an electrical company thing for charging you for that.
00:16:34.480 -->
00:16:37.120Um one more thing about that episode.
00:16:37.120 -->
00:16:43.519Uh, you know, I I mentioned Marlon helped me with a lot of that information because he is so freaking smart with that stuff.
00:16:43.519 -->
00:16:56.960Uh, he wanted me to point out that um, you know, I talked about how communities don't like data centers coming in, and and for obvious reasons, you know, the the the noise, the electric usage, the water usage.
00:16:56.960 -->
00:17:01.120The thing is, they all love what data centers can do for them, you know.
00:17:01.120 -->
00:17:12.640Yeah, take away a data center, take away Facebook, take away uh uh Instagram, take away Google, and people would be screaming because they love what they get out of these data centers.
00:17:12.640 -->
00:17:14.400It's kind of like an airport.
00:17:14.400 -->
00:17:18.319Nobody wants an airport built near them, but they all want airports so that they can travel.
00:17:18.319 -->
00:17:20.880That's that's kind of like how data centers are.
00:17:20.880 -->
00:17:25.440So that's a good point that he made, and I and I'm glad to repeat that for you.
00:17:25.440 -->
00:17:30.720Um I I don't think we have any other feedback from other episodes, right?
00:17:30.720 -->
00:17:34.480So I know I think we can get right into the meat then.
00:17:34.480 -->
00:17:38.079You know, 18 minutes in, we're finally talking about what we're talking about.
00:17:38.079 -->
00:17:40.559Um today we're talking about Git.
00:17:40.559 -->
00:17:47.119Um, the the uh it it's a fast, scalable, distributed revision control system.
00:17:47.119 -->
00:17:52.559Uh if you look at the man page for Git, it's kind of funny because it says Git, the stupid content tracker.
00:17:52.559 -->
00:17:55.279Because that's all it's doing, is tracking content for you.
00:17:55.279 -->
00:17:59.039And in our case, the content is is source code for programs.
00:17:59.039 -->
00:18:00.240But you can do a lot with Git.
00:18:00.240 -->
00:18:05.200You can you can store your RC files, you can store uh uh documents.
00:18:05.200 -->
00:18:11.599Uh you know, if you're an author, you could you could uh if you're using a text editor, uh you could use git to to track that.
00:18:11.599 -->
00:18:16.000I guess even if you're using like a word or or something, you you can use git to track that.
00:18:16.319 -->
00:18:18.480And although diff is harder.
00:18:19.359 -->
00:18:23.440Yeah, diff on a on a on a blob of data is is difficult.
00:18:23.440 -->
00:18:28.480Um but anyway, uh so Git's been around since 2005.
00:18:28.480 -->
00:18:32.400It was written by Linus Torvalds, the Linux kernel guy.
00:18:32.400 -->
00:18:34.559Uh he had an itch to scratch.
00:18:34.559 -->
00:18:38.960Uh they were managing kernel development using BitKeeper.
00:18:38.960 -->
00:18:45.839And uh and there was a um there was a kind of a fallout uh with the company that provides GitKeeper.
00:18:45.839 -->
00:18:50.640Uh it's it's a proprietary uh uh source code management system.
00:18:50.640 -->
00:18:55.119Uh and uh they were granted a license to use it for Linux kernel development.
00:18:55.119 -->
00:19:00.480I think anybody that wanted to develop on the kernel uh could use BitKeeper, the license extended to that.
00:19:00.480 -->
00:19:16.640But then um uh Andrew Trigell, the guy behind Samba and Rsync, uh he tried to reverse engineer the protocol for BitKeeper so that he could write some tools that could interact with with the BitKeeper uh repository.
00:19:16.640 -->
00:19:29.759And um uh the BitKeeper guys got angry and revoked the license, which is not good if you're a kernel developer and you're relying on that to to uh manage your source code.
00:19:29.759 -->
00:19:34.000So Linus did what Linus does, he just wrote his own.
00:19:34.000 -->
00:19:42.079And uh apparently it took him like two weeks to get it into a working state, and once he had it up and working, he handed it over to somebody else to maintain it.
00:19:42.079 -->
00:19:47.039He's not really involved in it anymore, although he's probably uh a huge user of it.
00:19:47.039 -->
00:19:50.799Um but it's a brilliant tool.
00:19:50.799 -->
00:19:55.519Uh, and you know, almost everybody writing software is using it.
00:19:55.519 -->
00:19:59.759Not completely everybody, there's other solutions out there, but an awful lot of people are.
00:19:59.759 -->
00:20:00.400Using it.
00:20:00.400 -->
00:20:01.839And I think a lot of people are like me.
00:20:01.839 -->
00:20:05.759They kind of use it and they don't really totally understand every aspect of it.
00:20:05.759 -->
00:20:08.480So here we have uh Wolf.
00:20:08.480 -->
00:20:12.240Wolf knows more about Git than anybody I've ever met.
00:20:12.240 -->
00:20:15.039When I have a problem, it is so comforting to know.
00:20:15.039 -->
00:20:18.960I can ask Wolf uh, you know, what's going on here, and he explains it to me.
00:20:18.960 -->
00:20:22.400And and he turned me on to Git, I think, in 2017.
00:20:22.400 -->
00:20:25.920So I've been using it for uh like eight and a half years.
00:20:25.920 -->
00:20:29.279And uh every time I've had a problem, he's been there to help me out.
00:20:29.279 -->
00:20:34.079And uh I don't call him so much about this stuff anymore because he did such a good job of helping me.
00:20:34.079 -->
00:20:41.759Uh, but I have to think that all the questions that I've asked him over the years, uh, a lot of people out there probably have similar questions.
00:20:41.759 -->
00:20:51.039Uh so we're gonna talk about those and we're gonna discuss some some features of Git that you probably don't know exist, but once you do, you're gonna think that's pretty cool.
00:20:51.039 -->
00:20:52.559I'm gonna start using that.
00:20:52.559 -->
00:20:56.079So I don't know, how do we start this thing, Wolf?
00:20:56.079 -->
00:20:57.519Uh what do you want to say?
00:20:57.920 -->
00:21:02.400There there is something I wanna start us off with, if that if that's okay.
00:21:02.400 -->
00:21:02.960Yeah.
00:21:02.960 -->
00:21:15.920Um so you know, Git has its own philosophy and its own reasons, but I want to talk for just a second about the thing.
00:21:15.920 -->
00:21:17.200Why git?
00:21:17.200 -->
00:21:22.880Why should you use well, source code control at all, but git in particular.
00:21:22.880 -->
00:21:39.599And the reason is source code control systems, um, and I have experience uh with how and why this is true for Git, they provide a kind of safety um that is uh super, super high level.
00:21:39.599 -->
00:21:46.240You are everything that you commit is safe.
00:21:46.240 -->
00:21:56.640Um if you also push it, uh which we'll talk about later, um, then it's safe even from the idea of your disk failing utterly.
00:21:56.640 -->
00:22:07.759Now, things that you haven't yet committed, uh uncommitted changes, what we modifications in your working directory, those are completely unsafe.
00:22:07.759 -->
00:22:09.599So don't get confused.
00:22:09.599 -->
00:22:11.920If you delete those, they're gone.
00:22:11.920 -->
00:22:16.640If you commit them, they're available forever no matter what happens next.
00:22:16.640 -->
00:22:23.440Um as long as there's a repository with those commits in them, you can get them back.
00:22:23.440 -->
00:22:26.240So safety is the core.
00:22:26.240 -->
00:22:35.839Uh and on because of that safety, because you can get back anything the way it used to be, that means you can experiment.
00:22:35.839 -->
00:22:44.559You can try things, and when they don't work out, uh you could go back, and when they do work out, great, that's the new world.
00:22:44.559 -->
00:22:45.759That's where you are.
00:22:45.759 -->
00:22:54.559So Git is like the answer to all of these problems that you didn't realize were the problem that you are having.
00:22:54.559 -->
00:23:00.319Um that's the whole reason to listen to the rest of this episode.
00:23:00.319 -->
00:23:09.759Because your source will be safe, you can try things when you didn't realize you could try things, and you can get back to where it was still good.
00:23:09.759 -->
00:23:14.319Um so that's something I wanted to get off my chest right away.
00:23:14.319 -->
00:23:27.680Uh, and I feel like from here we should talk about the things that you encountered on your Git journey and what uh what's important about those things.
00:23:27.839 -->
00:23:30.240Why don't why don't you you tell me what it is?
00:23:30.240 -->
00:23:32.400The top of the list, you've already mentioned it.
00:23:32.400 -->
00:23:33.440Let's get into it a little bit.
00:23:33.440 -->
00:23:34.480But commit.
00:23:34.480 -->
00:23:36.799Uh what does it mean to commit?
00:23:37.759 -->
00:23:43.599So Git is different from any previous source code control system.
00:23:43.599 -->
00:23:47.599Uh and since Git, other things do do this.
00:23:47.599 -->
00:23:52.079But as far as I am aware, Git was one of the first, and that is this.
00:23:52.079 -->
00:24:03.039When you get to a point in time where things are good, um Git takes an atomic snapshot.
00:24:03.039 -->
00:24:16.079When you say the word commit, the things that you have collected together to be part of that commit, that exact version gets saved just the way it is.
00:24:16.079 -->
00:24:23.119Now, before this, in the olden days, uh they weren't atomic and they weren't snapshots.
00:24:23.119 -->
00:24:30.880Instead, um, like CVS, for instance, would say, okay, uh, we're working on the file main.c.
00:24:30.880 -->
00:24:46.079Uh main.c got these changes, and now there is a file that essentially is main.c, but with hunks that are, and then these changes, and then these changes, and then these changes.
00:24:46.079 -->
00:24:48.400Not at all a snapshot.
00:24:48.400 -->
00:25:00.400Um Git, you can actually look in the thing it calls the object database, which is what's inside that.get folder, um, and you can pull out individual objects.
00:25:00.400 -->
00:25:03.599Where a file is an object called a blob.
00:25:03.599 -->
00:25:11.119Uh they're all compressed, and and there's things layered on top of that that aren't really part of the underlying model that makes it even smaller.
00:25:11.119 -->
00:25:13.279But the whole history is there.
00:25:13.279 -->
00:25:17.519Um, and except for these things layered on top, it's not about deltas.
00:25:17.519 -->
00:25:26.319Yeah, you can diff two things and find out what actually changed between these two things, but that's the thing Git actually does on the fly.
00:25:26.319 -->
00:25:28.640Um, so that's what a commit is.
00:25:28.640 -->
00:25:34.720A commit is a snapshot, and it's a snapshot at an instant in time.
00:25:34.720 -->
00:25:41.359Um there's important stuff to know about commits.
00:25:41.359 -->
00:25:50.480Commits are the fundamental unit in Git, and every problem you solve has something to do with commits.
00:25:50.480 -->
00:26:06.960So there's a couple of things that when you're building a new commit, you want to make sure you get right so that later, when you have to use one of these techniques to solve a problem, your commits help you instead of hurt you.
00:26:06.960 -->
00:26:36.880Um so one thing is there are standards or uh suggestions for how to uh lay out your git commit message, like what to say and what to mention, and that the summary is a short line so that it can show up in all the tools that so show short things and uh you know what kinds of things you should put in it and how to reference things, you know, stuff like that.
00:26:36.880 -->
00:26:40.960So definitely format your message correctly.
00:26:40.960 -->
00:26:58.160Um your commits in your own before you have arranged them, and there are tools so that you can use commit in the same way that you might use save when you're working on a Word document or in a text file or whatever.
00:26:58.160 -->
00:27:03.440Uh you could just commit over and over again, and each commit is just my current save.
00:27:03.440 -->
00:27:13.920Um the thing you want to present to the world is a chain of commits, if it takes three, you know, or if you can do all in one, fine.
00:27:13.920 -->
00:27:19.599Where each commit in that chain is one thing.
00:27:19.599 -->
00:27:34.400A complete idea that runs, builds, does whatever it is by itself, so that if you went back in time with your with your repo to that commit, your thing, whatever you're building, could run.
00:27:34.400 -->
00:27:44.079But if you take the whole branch or what whatever you're working on, the chain of three, um, you've added a complete thing that took three features to build.
00:27:44.079 -->
00:27:53.200So each commit does one complete thing, each com commit builds, and you try to go in a straight line.
00:27:53.200 -->
00:27:59.759When you make a commit, um there's the easy way, you can say get commit minus a.
00:27:59.759 -->
00:28:07.519It's stuff that makes it be everything you've changed becomes part of this new commit you're making.
00:28:07.519 -->
00:28:09.279I don't do it that way.
00:28:09.279 -->
00:28:13.039Um and as you get more advanced, you won't do it that way either.
00:28:13.039 -->
00:28:16.799Uh instead, there's this thing called the staging area.
00:28:16.799 -->
00:28:18.480It has a couple of different names.
00:28:18.480 -->
00:28:31.359But what the staging area is, is it is an exact picture of what will be committed when you say commit.
00:28:31.359 -->
00:28:34.720Um so you have modifications.
00:28:34.720 -->
00:28:41.839I changed this file and that file and the other thing, but you only add main.c to the to the staging area.
00:28:41.839 -->
00:28:42.960You stage it.
00:28:42.960 -->
00:28:45.279You say get add main.c.
00:28:45.279 -->
00:28:51.920If you say commit right at that moment, you make a brand new commit that only has add.c.
00:28:51.920 -->
00:28:55.680And if that was the right thing for your commit, that's that's the right thing.
00:28:55.680 -->
00:29:03.359So learning about this extra thing that you never had to worry about, the staging area, that's part of your journey.
00:29:03.359 -->
00:29:14.079Um when you want to undo something, uh, modern versions of Git offer the restore command.
00:29:14.079 -->
00:29:20.559Um if it's kind of a big thing and you're not gonna you might want there's another command called reset.
00:29:20.559 -->
00:29:22.960Sometimes that comes into play.
00:29:22.960 -->
00:29:42.559And a really, and this is gonna be the last thing I say about commits, as you're building up that staging area, as you're putting together what's going to be your commit, maybe you were editing main.c and you were actually sticking in two different things, two different features at the same time.
00:29:42.559 -->
00:29:57.279Um you're making it take parameters, and you're also making it um not uh work on top of um map tiles that are in Florida.
00:29:57.279 -->
00:29:58.559I don't know, something like that.
00:29:58.559 -->
00:30:00.240But two totally different features.
00:30:00.240 -->
00:30:02.559You just happen to edit them all at once.
00:30:02.559 -->
00:30:18.400Um instead of just adding and committing main.c, you can add interactive and you can step through the the your terminal will show you this, the hunks of changes in that file.
00:30:18.400 -->
00:30:25.519Each hunk is a uh sort of a touching, connected set of lines that changed.
00:30:25.519 -->
00:30:35.119And for each one of those hunks, you can add it or skip it, or um it might be that you can actually split it into smaller hunks.
00:30:35.119 -->
00:30:37.839You can't always do that, but it uh sometimes.
00:30:37.839 -->
00:30:45.039So add interactive lets you make the two commits that you meant instead of the one commit that would have been easy.
00:30:45.279 -->
00:30:50.319Um I've used this a few times and it's it amazes me every time.
00:30:50.319 -->
00:30:59.440And yeah the way I see it works is you do a git add minus i and it pops up a little user interface, and it's not very intuitive for me anyway.
00:30:59.440 -->
00:31:01.119I have to relearn it every time I do it.
00:31:01.119 -->
00:31:09.039But the minus i causes it to be interactive, and then it steps through the the hunks and it shows you the little hunk, and you can decide you want to add it.
00:31:09.039 -->
00:31:27.279And when you're all done, you've added some hunks, maybe not all of them, and then you do your git commit, and that commits that change, and then you go do the git add again, uh, and maybe you want to get all the rest, so you just say git add, or maybe you want to get part of it again, and you so you do git minus i.
00:31:27.279 -->
00:31:32.880So you do this until you've committed everything, but it's all separate commits, and it's it's pretty slick.
00:31:32.880 -->
00:31:34.640I like it.
00:31:34.640 -->
00:31:37.119That's a superpower, yeah.
00:31:37.119 -->
00:31:45.119So uh so you know the first thing you gotta do if you're using a control source code control system is you're gonna make changes and commit them.
00:31:45.119 -->
00:31:49.680Uh, once you've committed a few things, then like me, I want to look at what's out there.
00:31:49.680 -->
00:31:50.640What did I change?
00:31:50.640 -->
00:31:51.680What did I commit?
00:31:51.680 -->
00:31:53.039What what are my commits?
00:31:53.039 -->
00:31:55.359What's the history of what I did?
00:31:55.359 -->
00:31:58.559Um, and there's a number of commands you can use for that.
00:31:58.559 -->
00:32:00.880Tell us a little bit about those.
00:32:01.519 -->
00:32:05.519Um there's tons of ways of looking at things.
00:32:05.519 -->
00:32:10.559Um, probably chief among those is git status.
00:32:10.559 -->
00:32:19.759Um I actually and let me say right now, um, git status prints a lot of stuff.
00:32:19.759 -->
00:32:24.799It prints the things that you've added that are ready to be committed right the second.
00:32:24.799 -->
00:32:36.480Things that are not added, uh, it can also, if you ask it nicely, print the things that are ignored, because we talked about the ability to ignore things.
00:32:36.480 -->
00:32:50.319Um use git status with no options, git status prints instructions on how to take things you've already added and make them not be added.
00:32:50.319 -->
00:32:51.599Oh, it was a mistake.
00:32:51.599 -->
00:32:53.359I don't want to commit main.c.
00:32:53.359 -->
00:32:55.279How do I make it get not be added?
00:32:55.279 -->
00:32:55.759Right.
00:32:55.839 -->
00:32:59.519You did a git add on a file and you realized you didn't really want to add that file.
00:32:59.519 -->
00:33:04.160So you can undo that with um I I've I forget the command.
00:33:04.160 -->
00:33:05.839I I I don't bother committing it to make it.
00:33:05.839 -->
00:33:07.759Git restore minus minus staged.
00:33:07.759 -->
00:33:08.400Yeah.
00:33:08.400 -->
00:33:10.960Get status always tells me what to do.
00:33:11.599 -->
00:33:12.400That's right.
00:33:12.400 -->
00:33:17.359So now I say git status constantly.
00:33:17.359 -->
00:33:20.160And I are I know those instructions.
00:33:20.160 -->
00:33:22.880I can always get them by saying git status.
00:33:22.880 -->
00:33:26.799But there's a thing in git you can do, which is a configuration option.
00:33:26.799 -->
00:33:29.200You can set it in your.git config.
00:33:29.200 -->
00:33:31.359Um it's called an alias.
00:33:31.359 -->
00:33:40.480And I have aliased uh st git get st to mean status minus s.
00:33:40.480 -->
00:33:43.519Uh I think you can also say minus minus short.
00:33:43.519 -->
00:33:45.839And that doesn't print any messages.
00:33:45.839 -->
00:33:51.039It's actually um a very compact list of what the changes are.
00:33:51.039 -->
00:33:52.640I do that constantly.
00:33:52.640 -->
00:33:55.680Um I absolutely do it before a commit.
00:33:55.680 -->
00:34:02.160I absolutely do it when I get into a brand new directory that I was working on yesterday or whatever.
00:34:02.160 -->
00:34:06.240So git status um super important.
00:34:06.240 -->
00:34:15.360Uh a thing that you might use git status for is to see do I have any modified files at all?
00:34:15.360 -->
00:34:18.480Do I have any added files at all?
00:34:18.480 -->
00:34:20.239Uh, for instance.
00:34:20.239 -->
00:34:30.559That's so important that to me anyway, and to everyone that I teach this to, it is worth modifying your prompt.
00:34:30.559 -->
00:34:38.800Um so my prompt shows me the branch that I'm on, and we're going to talk about branches in a second.
00:34:38.800 -->
00:34:43.360If I have any modified files at all, I'll see an asterisk.
00:34:43.360 -->
00:34:48.320If I have any added files at all, I'll see a plus.
00:34:48.320 -->
00:34:58.079If I have any brand new files that could be added, but haven't ever been part of the repo yet, um, I see a percent sign.
00:34:58.079 -->
00:35:04.079There are multiple ways to get your prompt to show you these things.
00:35:04.079 -->
00:35:23.760Git comes with, um, if you have the the actual git repo, if you've cloned git itself, um, you can grab the git PS1 prompt, and it's it's a shell function that you can call from your PS1 so you'll see it.
00:35:23.760 -->
00:35:33.199Or you can do the easy and in my opinion, significantly a better thing, which is use one of the existing prompts in the world.
00:35:33.199 -->
00:35:34.800I use Starship.
00:35:34.800 -->
00:35:38.880Um, it's super fast, it has tons of modules.
00:35:38.880 -->
00:35:42.719Um Git is one of them, and it does all the things that you want.
00:35:42.719 -->
00:35:46.000Um so now you're showing it.
00:35:46.480 -->
00:35:57.199Yeah, in your in your prompt that you're sitting there in bash or Z shell or whatever, and uh normally it would show like what your current directory is and maybe how you're logged in.
00:35:57.199 -->
00:36:00.159You know, if you're logged in as yourself or if you're super user or whatever.
00:36:00.159 -->
00:36:06.239Uh but you can show additional stuff in there just by modifying the PS1 environment variable.
00:36:06.239 -->
00:36:08.880Uh there's a couple other things you can change too.
00:36:08.880 -->
00:36:20.400But in your case and in mine, we display if if we're in a uh a direct a subdirectory of a git repo, it'll tell us a little bit of information about that repo right at the command line.
00:36:20.400 -->
00:36:23.199We don't have to type git status, it's just there.
00:36:23.760 -->
00:36:24.079Right.
00:36:24.079 -->
00:36:26.400Stuff you really want to know.
00:36:26.400 -->
00:36:32.880Because in a world where, and this isn't everybody yet, but maybe by the end of this podcast it will be.
00:36:32.880 -->
00:36:40.639But in a world where there are multiple branches, knowing which branch you're on, am I committing to the right branch?
00:36:40.639 -->
00:36:45.679Because usually a branch is I'm gonna try to do this thing.
00:36:45.679 -->
00:36:50.880And when you're editing a file, it's probably about trying to do this thing.
00:36:50.880 -->
00:36:52.880So you want to be on the right branch.
00:36:53.199 -->
00:36:56.800Yeah, I've got the branch in my prompt and it and it helps.
00:36:56.800 -->
00:37:03.119It uh it helps me know which system I'm on because we we use git to deploy our software for our clients.
00:37:03.119 -->
00:37:06.639And if I'm on their system, they're they're in the main branch.
00:37:06.639 -->
00:37:07.840So that's my indicator.
00:37:07.840 -->
00:37:09.360I don't want to be making changes here.
00:37:09.360 -->
00:37:15.039If I forget which system I happen to be logged in on at that moment, the prompt helps me figure that out.
00:37:16.639 -->
00:37:28.159Uh so uh the actual way that commits are all arranged is uh more complicated than I'm about to say.
00:37:28.159 -->
00:37:36.559But it's I don't want to get into it because I don't want to uh lead you guys down a path that has nothing to do with the things we want to talk about.
00:37:36.559 -->
00:37:45.679But as we've been saying right here, uh often what you care about is that the sequence of git commits that you have made is just that.
00:37:45.679 -->
00:37:47.280It's a sequence, it's a chain.
00:37:47.280 -->
00:37:56.880There was the very first thing you committed, and then when you made changes and committed that, that came on top of the previous commit.
00:37:56.880 -->
00:38:08.239So if you're at commit number eight, you could say git log, that's one of the commands, and see all eight of the commits that you go back to.
00:38:08.239 -->
00:38:14.800This is uh these commits define what is in the source code that you are looking at right now.
00:38:14.800 -->
00:38:28.880So git log um sounds simple, uh, and I'm not gonna go into all its powers, but if you do help about log, log can be used for so many things.
00:38:28.880 -->
00:38:45.119Um you can find commits by specific authors, commits that changed specific functions, added or removed specific um strings, um, happened in a particular date range.
00:38:45.119 -->
00:39:00.639You can show just the summary line, you can show the whole message, you can show only commits whose uh commit message named a specific uh ticket, whatever your ticketing system is.
00:39:00.639 -->
00:39:03.119Log is gonna be your friend.
00:39:03.119 -->
00:39:08.960Um another thing that is your friend is uh git show.
00:39:08.960 -->
00:39:25.519Um with no uh anything besides uh git show, it's gonna basically uh show you exactly what happened in the commit that is the thing that just got committed.
00:39:25.920 -->
00:39:26.159Right.
00:39:26.159 -->
00:39:28.480So you let me interrupt you for a second.
00:39:28.480 -->
00:39:37.760You do a git log and it shows you a commit ID and then a summary of uh well it shows you the commit message with some other data, like the time and who did it and stuff.
00:39:37.760 -->
00:39:44.159It's primarily it's going to show you your commit messages, and it'll show you the most recent one at the top, and then the next one, and the next one access.
00:39:44.159 -->
00:39:56.079So you got this commit ID, and with git show, you can say uh git space show space that commit ID, and it'll show you a it'll show you the code that was in that commit.
00:39:56.079 -->
00:39:59.119It's like a big diff, right?
00:40:00.400 -->
00:40:02.239That is exactly what it is.
00:40:02.239 -->
00:40:07.280And you can do that with any commit anywhere in history on any branch.
00:40:07.280 -->
00:40:07.679Yeah.
00:40:07.679 -->
00:40:12.800You can show uh individual files.
00:40:12.800 -->
00:40:21.440Um Git show is super powerful, and Git Show takes a lot of the same uh option flags that diff does.
00:40:21.760 -->
00:40:26.480Yeah, and you you mentioned uh if you do if you look for help on git, there's a couple of ways to do that.
00:40:26.480 -->
00:40:38.400Uh the one I use all the time is uh if you're on a uh a Linux box or a Mac, um the man command, and I'll type it like man space uh git hyphen show.
00:40:38.400 -->
00:40:42.239And it's the sh it's the man page for the show, the git show command.
00:40:42.239 -->
00:40:46.960Uh man space git hyphen log and it'll show you that.
00:40:46.960 -->
00:40:51.119Um you can also isn't isn't there a built-in help in git?
00:40:51.119 -->
00:40:54.159Can't I say like git show help or git help show or something?
00:40:54.400 -->
00:40:55.840Git show minus minus help.
00:40:55.840 -->
00:41:15.840And by the way, the thing you just said is very interesting because if you happen to be a scriptor and you write a script or program, whatever, named git-uh foo, that and you put it on your path somewhere so it's executable.
00:41:15.840 -->
00:41:26.960If you're in the terminal in a repo and you could call git, you can say git space foo, just like foo is a git command, and it'll run your script.
00:41:27.280 -->
00:41:27.920Really?
00:41:28.400 -->
00:41:28.880Yeah.
00:41:29.199 -->
00:41:30.400I did not know that.
00:41:30.400 -->
00:41:32.079Anyway, keep keep going.
00:41:32.079 -->
00:41:34.079I didn't mean to interrupt you there.
00:41:34.719 -->
00:41:36.880So diff is fundamental.
00:41:36.880 -->
00:41:48.159Um when you show something, if you're just showing a single commit, that's gonna show you the diff between that commit and the commit right before it.
00:41:48.159 -->
00:41:50.239What did this commit introduce?
00:41:50.239 -->
00:41:53.840Now remember, a commit is actually a snapshot.
00:41:53.840 -->
00:41:57.599So git is calculating that diff on the fly.
00:41:57.599 -->
00:42:09.280Uh and just like show and just like log, diff takes a ton of different interesting parameters that can um make it uh do what you want.
00:42:09.280 -->
00:42:20.639Uh in particular, uh minus minus uh name only, uh instead of showing you uh changes inside files, it just shows the names that changed.
00:42:21.519 -->
00:42:28.320Yeah, so if you do a git show, a commit ID, dash dash name only, and and I forget which order those go in.
00:42:28.320 -->
00:42:31.039Does the name dash dash name only go after or before?
00:42:31.039 -->
00:42:32.159I don't remember.
00:42:32.159 -->
00:42:38.559But uh you do that, and instead of showing you the diff in in each file, it just shows you the name of the file.
00:42:38.559 -->
00:42:42.320So you can see what files did this commit touch.
00:42:43.360 -->
00:42:55.760And if you only want the Perl files out of that, then uh a thing you could do is pipe that into uh grep and then give an expression that said dot pl.
00:42:55.760 -->
00:43:00.000Um and then you would have just the perl file.
00:43:00.000 -->
00:43:11.679Anyway, um but a thing that people love to do in Git, uh, and then once they run it, they are sad, um, is git blame.
00:43:11.679 -->
00:43:12.159Yes.
00:43:12.159 -->
00:43:15.840Um I think it was called annotate.
00:43:15.840 -->
00:43:18.639Uh I don't know what people want to call it.
00:43:18.639 -->
00:43:21.760Blame seems very, I don't know, political to me.
00:43:21.760 -->
00:43:30.800But the what Blame does is it will tell you um for any line, uh it'll show you the whole file.
00:43:30.800 -->
00:43:39.119Um usually it's integrated with editors as well, so that uh you can s actually see the lines and scroll around.
00:43:39.119 -->
00:43:49.440And but what it shows you is the commit ID that that line was last changed in.
00:43:49.440 -->
00:43:56.719And from that, you can know if you wrote your commit message right, why did this line change?
00:43:56.719 -->
00:43:58.320Who changed it?
00:43:58.320 -->
00:44:04.559Now, the reason most people run git blame is because they're like, who in the oh my god, who did this?
00:44:04.559 -->
00:44:05.760This is ridiculous.
00:44:05.760 -->
00:44:06.960Why would they write that?
00:44:06.960 -->
00:44:09.280This is me a couple of times a week.
00:44:09.280 -->
00:44:14.320They say get blame just to find out who the you know criminal is.
00:44:14.320 -->
00:44:15.519And it's them.
00:44:17.519 -->
00:44:19.119It's like, who would do that?
00:44:19.119 -->
00:44:23.199And then it turns out it was me, yeah, just like the day before yesterday, right?
00:44:24.239 -->
00:44:24.800Yeah.
00:44:24.800 -->
00:44:28.719So all of these things are non-destructive.
00:44:28.719 -->
00:44:30.480They show you information.
00:44:30.480 -->
00:44:46.159Um, git log shows you a list of commits strongly related to git log is um a thing you absolutely need to remember, and that is git reflog.
00:44:46.159 -->
00:44:48.320R-E-F-L-O-G.
00:44:48.320 -->
00:44:51.440Why am I telling you to remember this?
00:44:51.440 -->
00:44:58.559Because git reflog is the thing that helps you get back to a place that works.
00:44:58.559 -->
00:45:08.719If you didn't do the things you need to do to make experiments be okay, you know, do your experiment on a branch or, you know, whatever it takes.
00:45:08.719 -->
00:45:18.079And make your commits the right way, the reflog will show you where it was good and help you get back to that place.
00:45:18.079 -->
00:45:22.719Um, and it turns out there's two kinds of reflog.
00:45:22.719 -->
00:45:24.719They they both look and act the same.
00:45:24.719 -->
00:45:34.400But one is for this branch, um tell me what commits happened on it.
00:45:34.400 -->
00:45:36.480Where was the head of this branch?
00:45:36.480 -->
00:45:37.920What things did you do?
00:45:37.920 -->
00:45:42.880Oh, I merged, oh, I rebated, oh, I other stuff you haven't heard about yet.
00:45:42.880 -->
00:45:51.039Um, but there's also one, if you just say get reflog, that's not the reflog for any particular branch.
00:45:51.039 -->
00:45:57.840That's all the places your directory has been checked out to.
00:45:57.840 -->
00:46:07.280So if you have three branches, main and develop and weird experiment, and you switch between those.
00:46:07.280 -->
00:46:13.440Um, so first you're on one and then the next one, and then the third one, there's three entries in the reflog.
00:46:13.440 -->
00:46:15.199And they say why.
00:46:15.199 -->
00:46:18.960One says on main and one says on develop.
00:46:18.960 -->
00:46:27.679Um so you can see where you've been, where you're actually looking, what the editor says.
00:46:27.679 -->
00:46:31.360Um reflog is gonna save your butt.
00:46:31.360 -->
00:46:39.039Um so I think that's everything I want to talk about about showing things, and we're not going nearly fast enough.
00:46:39.519 -->
00:46:42.639No, this is gonna be a long, uh, a long episode.
00:46:42.639 -->
00:46:44.880Um, but it's still interesting stuff.
00:46:44.880 -->
00:46:52.800Um so one thing you you sort of drilled into me way early on when I started using Git was to use branches.
00:46:52.800 -->
00:47:00.079Now, primarily we have a main branch and a dev branch, uh, but occasionally I'll create a uh a feature branch.
00:47:00.079 -->
00:47:07.280The the idea between main and dev is uh main is what I give my clients, dev is what we're working on.
00:47:07.280 -->
00:47:15.920When we're when we've made a bunch of changes, committed them to dev and we're happy with it, then we'll merge dev into main and deploy that to the client.
00:47:15.920 -->
00:47:21.599Uh but you you keep telling me I should be using all kinds of branches, and I do somewhat when I'm working on a feature.
00:47:21.599 -->
00:47:23.519So tell us a little bit about that.
00:47:24.880 -->
00:47:28.400Branching at all is a superpower.
00:47:28.400 -->
00:48:03.519Um this gives you uh at least this one really important uh feature, which is instead of a world where all you have is I'm working on the source, and if an experiment goes wrong, I can go back in time with the reflog, instead of that world, you can have this world where you have a branch, which is one course of development, um, and let's call that branch release or main or whatever you want, and you make promises.
00:48:03.519 -->
00:48:08.159Git doesn't help you with these, this is just a promise you and your team make together.
00:48:08.159 -->
00:48:14.239You say release always builds and passes all tests.
00:48:14.239 -->
00:48:32.960If at any time we need to give somebody the very best uh working instance of our product with every bug that we know of fixed, it may have bugs in it, but n we don't know about them yet.
00:48:32.960 -->
00:48:36.639We can just build main and hand it to them.
00:48:36.639 -->
00:48:38.800Or release, whatever we call it.
00:48:38.800 -->
00:48:42.639And then you could have another branch that is develop.
00:48:42.639 -->
00:48:47.360And develop is everything that's in main plus some other stuff.
00:48:47.360 -->
00:48:52.079Whatever you're working on that isn't ready to be released yet.
00:48:52.079 -->
00:48:56.320Um, isn't finished or doesn't you know, might might have bugs.
00:48:56.719 -->
00:48:59.039You're not ready for other people to see this work yet.
00:48:59.039 -->
00:49:01.039You're you're in the middle of making changes.
00:49:01.039 -->
00:49:02.239It's a draft.
00:49:02.239 -->
00:49:02.639Exactly.
00:49:02.639 -->
00:49:04.159Yeah, it's a draft.
00:49:05.119 -->
00:49:05.440Yeah.
00:49:05.440 -->
00:49:24.719Now if you're on a big team, um, you know, four people, let's say, uh, it's totally reasonable that each person has branches, especially if you're in a situation where you have to do things um at multiple at the same time.
00:49:24.719 -->
00:49:28.079So you would have a thing we call a feature branch.
00:49:28.079 -->
00:49:34.400And a feature branch is just what it takes to implement this one thing.
00:49:34.400 -->
00:49:42.559And when that feature works, maybe you merge it directly back into release after your whole team has code reviewed it.
00:49:42.559 -->
00:49:50.880Or maybe that means it's ready for develop to see how it interacts with all the other stuff people are working on.
00:49:50.880 -->
00:49:53.599Are there any logical conflicts?
00:49:53.599 -->
00:50:04.079Um, but the notion is that if you only look at this one branch, nothing else is there to interfere.
00:50:04.079 -->
00:50:09.840It's main plus the stuff you are doing just for this one feature.
00:50:09.840 -->
00:50:20.320Another thing you might use a branch for is there are points in time, like you have customer A, and customer A got a release in March.
00:50:20.320 -->
00:50:23.920But, you know, now it's December.
00:50:23.920 -->
00:50:30.559So Maine has moved on, but for whatever reason, they don't have a dis a December release.
00:50:30.559 -->
00:50:33.360Uh what they've got is from March.
00:50:33.360 -->
00:50:36.159Um and now they need a hot fix.
00:50:36.159 -->
00:50:41.519There's some bug, it's a problem, you didn't know about it before, and you need to fix it.
00:50:41.519 -->
00:50:47.039What you do is you go to the commit that is their release.
00:50:47.039 -->
00:50:52.320Um, this is the s the soul of a thing we call reproducible releases.
00:50:52.320 -->
00:50:59.519Um, and your release is probably tagged, that's a thing we can talk about later, and you make a branch off of that.
00:50:59.519 -->
00:51:02.079That branch is a hot fix branch.
00:51:02.079 -->
00:51:07.599You figure out how to fix that bug on that branch.
00:51:07.599 -->
00:51:13.599And then you, when it works, you ship them a release from that hotfix.
00:51:13.599 -->
00:51:22.159So now they have exactly the release they already had, plus only the fix for that one bug.
00:51:22.159 -->
00:51:30.239But that bug fix, a commit, isn't on release itself yet.
00:51:30.239 -->
00:51:32.000It's branched off of release.
00:51:32.000 -->
00:51:37.280So now you also do a thing that we're gonna talk about called cherry pick.
00:51:37.280 -->
00:51:45.920You cherry pick that release fix or merge, either one of those is fine, back onto the main release branch.
00:51:45.920 -->
00:51:47.599Now everybody has it.
00:51:47.599 -->
00:51:52.719They have exactly the release they want, you've got the bug fix, everything is good.
00:51:54.880 -->
00:51:56.079I've done that.
00:51:56.079 -->
00:51:57.840It's very, very powerful.
00:51:57.840 -->
00:52:00.320It's really cool.
00:52:00.559 -->
00:52:02.719Um yeah.
00:52:02.719 -->
00:52:08.239There's two other tiny things I want to say about branches.
00:52:08.239 -->
00:52:15.840Um I told you enough that that you would understand why you want to have them.
00:52:15.840 -->
00:52:20.079But how do you focus on one branch or the other?
00:52:20.079 -->
00:52:24.320How are you making changes on this branch, but not on that branch?
00:52:24.320 -->
00:52:32.079And how you do that is you use the command get switch, and then you name the branch you want to go to.
00:52:32.079 -->
00:52:32.559Right.
00:52:32.559 -->
00:52:34.079So you've you've created a branch.
00:52:34.079 -->
00:52:37.519When you do that, that's your current branch now.
00:52:37.519 -->
00:52:39.280Um, and you can switch back.
00:52:39.280 -->
00:52:43.360Make your commits, make sure that you don't just leave changes hanging around.
00:52:43.360 -->
00:52:43.840Right.
00:52:44.000 -->
00:52:52.000I mean, so now you've got you've got uh your main branch and you've got maybe your dev branch for development, and then you've created a feature branch.
00:52:52.000 -->
00:52:52.800You're working on this.
00:52:52.800 -->
00:52:54.239Now you've got three branches.
00:52:54.239 -->
00:52:57.519You can do the git branch command to list them, right?
00:52:57.519 -->
00:52:59.519It'll it'll list all the branches you have.
00:52:59.519 -->
00:53:07.360And then you can do git branch uh git switch and then name that branch if you want to get back to main, git switch main.
00:53:07.360 -->
00:53:09.280And that takes you back to main.
00:53:09.280 -->
00:53:11.119And it's pretty cool.
00:53:11.199 -->
00:53:25.360And it's now a thing to know is this if you have modified files in your working directory and you switch back to main, but you didn't add or commit those changes, well, they're not part of a commit.
00:53:25.360 -->
00:53:28.159They're files in your working copy.
00:53:28.159 -->
00:53:33.119And that means they're still going to be modified when you're back in main.
00:53:33.119 -->
00:53:33.519Right.
00:53:33.599 -->
00:53:35.679They're still in your working directory.
00:53:36.320 -->
00:53:36.559Right.
00:53:36.559 -->
00:53:39.679In other words, changes follow you.
00:53:39.679 -->
00:53:43.039I mean, that's not really what happens, but that's the way to think about it.
00:53:43.039 -->
00:53:44.239Changes follow you.
00:53:44.239 -->
00:53:44.559Yeah.
00:53:44.559 -->
00:53:53.599So if those changes aren't actually appropriate for main, um there's two answers, uh uh a good one and uh okay one.
00:53:53.599 -->
00:53:58.719The good one is commit them, um, because maybe they're you're ready to commit them.
00:53:58.719 -->
00:54:03.039And the okay one is stash them temporarily.
00:54:03.039 -->
00:54:05.760Git stash is a command.
00:54:05.760 -->
00:54:16.239Um it doesn't matter how git stash works, just the fact is those files will be safe, as safe as if they were committed, because it turns out they are.
00:54:16.239 -->
00:54:18.159But they're in a little holding place called the stash.
00:54:18.159 -->
00:54:19.760They're in a little holding place.
00:54:19.760 -->
00:54:25.679Uh a thing to know about the stash is don't use the stash for long-term storage.
00:54:25.679 -->
00:54:32.800Set some things aside with the stash so you can do some operation and then bring them back quickly.
00:54:32.800 -->
00:54:41.119If you have stuff you want to keep around for a long time, commits and branches are the way to do that.
00:54:41.119 -->
00:54:48.880Um and finally, there is one other situation that is super confusing to get to the sounds scary.
00:54:48.880 -->
00:54:51.280It does sound scary.
00:54:51.280 -->
00:54:53.199Um, and and that is this.
00:54:53.199 -->
00:54:57.039First, I have to give you this little backing piece of information.
00:54:57.039 -->
00:55:04.159A branch is really just a name that points to a specific commit.
00:55:04.159 -->
00:55:16.960So when you switch to a commit, all you're doing is saying, hey, working copy, you now need to be a reflection of what the snapshot looked like in such and such a commit.
00:55:16.960 -->
00:55:41.679But the magic of a branch is, if you're on a branch, if you've switched to it, if you've checked it out, whatever, and you make a new commit with changes that you've added, the magic of a branch is that name, the branch name, which is called a ref, by the way, gets updated to point to the new commit.
00:55:41.679 -->
00:55:45.599It advances as you grow the chain of commits.
00:55:45.599 -->
00:55:46.960Okay.
00:55:46.960 -->
00:55:55.760But y pointing your working copy to a specific commit doesn't need to have a branch.
00:55:55.760 -->
00:56:03.360So I could check out some commit in history, but now I'm not on a branch.
00:56:03.360 -->
00:56:13.039Um and if I make another commit, there's no magical name that points to that commit that gets updated and moved.
00:56:13.039 -->
00:56:25.519And more importantly, because nothing long-lived points to that brand new commit, um it is dangling.
00:56:25.519 -->
00:56:38.239Um that means that if you don't act, that commit will be garbage collected in some amount of time, 30 days, 90 days, uh, and you can set this um in your config.
00:56:38.239 -->
00:56:50.239When you do this, the instant you do it, git reports to you the danger of your situation, and it tells you with completely obvious terminology.
00:56:50.239 -->
00:56:53.119It says, you are on a detached head.
00:56:53.119 -->
00:56:55.440What what does that mean?
00:56:55.440 -->
00:56:59.440How are you supposed to know what that means?
00:56:59.440 -->
00:57:00.639I don't know.
00:57:00.639 -->
00:57:02.320Um, but that's what that means.
00:57:02.320 -->
00:57:03.440You're not on a branch.
00:57:03.440 -->
00:57:09.119When you're on a detached head, you can make a branch right where you are, and that's probably what what you want.
00:57:09.119 -->
00:57:09.760Yeah, this is the same thing.
00:57:10.079 -->
00:57:24.960The safe thing would be do a uh git switch and then some tag name or some commit ID to get to that point in time, and now you're on a detached head, so now you create a branch and now you're safe, right?
00:57:24.960 -->
00:57:25.679You got the right.
00:57:25.920 -->
00:57:28.800And in fact, you can do that all in one step if you want.
00:57:28.800 -->
00:57:33.599You can say git switch minus C, the new name.
00:57:33.599 -->
00:57:35.679Uh minus C means create.
00:57:35.679 -->
00:57:38.960Um then as a final argument, where.
00:57:38.960 -->
00:57:42.159Um and where is any other ref.
00:57:42.159 -->
00:57:45.360It could be a tag, it could it could be a commit hash, whatever.
00:57:45.679 -->
00:57:52.320Okay, so now you've got a branch, and now you can make your commits and stuff, and uh and uh you're safe, it'll be saved.
00:57:52.320 -->
00:58:01.599Um and then you can decide to either throw it away or or merge into dev or into main or whatever you need to do.
00:58:02.639 -->
00:58:03.519That's exactly right.
00:58:03.760 -->
00:58:07.119And if you do throw that branch away, you don't lose your original code.
00:58:07.119 -->
00:58:10.719You only lose whatever you committed on that branch, right?
00:58:10.719 -->
00:58:12.960If you throw that branch, if you delete that branch.
00:58:12.960 -->
00:58:17.039All right, so you've talked a lot about references.
00:58:17.039 -->
00:58:24.800You mentioned reflog and and commits and and and stuff, so why don't we talk a little bit about really what references are?
00:58:25.920 -->
00:58:30.960Um okay, so the we we talked about the idea of snapshots.
00:58:30.960 -->
00:58:46.559And a snapshot means that the entire picture of your uh working directory, your working copy, um is stored in individual objects in the object database.
00:58:46.559 -->
00:58:50.159This actually turns out to be way more efficient than you thought.
00:58:50.159 -->
00:58:58.559Uh the reason is maybe you commit three files, but every other single file is exactly the same.
00:58:58.559 -->
00:59:02.400Well, in Git, a file doesn't have a version.
00:59:02.400 -->
00:59:14.800Um there's a piece of content, and it if it the content is the same in the previous version and this version, then it's just the one object, it's the same object.
00:59:14.800 -->
00:59:31.360So all that changes when you make a commit is um the chain from the deepest file of this tree of objects all the way up to the root, and then there's a new object added that is this commit object at the top.
00:59:31.360 -->
00:59:52.159So the kinds of objects that are in the object uh database, forget, are blobs, that's a file, uh trees, that's a directory, um uh commits, um that's the t the root of one of these snapshots, and this other thing, which is a tag.
00:59:52.159 -->
00:59:55.119Uh and that's only annotated tags.
00:59:55.119 -->
00:59:59.840Uh there are tags that don't have objects and they can go away pretty easily.
00:59:59.840 -->
01:00:03.760So if you really want a tag, you probably want an annotated tag.
01:00:03.760 -->
01:00:18.639Now a ref is any way, anyway at all, of um choosing one of those objects.
01:00:18.639 -->
01:00:29.760If the object has a name, like a branch uh is a name, um that that ref uh here's some example refs.
01:00:29.760 -->
01:00:33.679Every one of those objects has a hash.
01:00:33.679 -->
01:00:53.199An ob an object hash for a commit uh that same object hash, we we we often refer to it as the commit hash or the commit ID, but essentially it's the hash of um the underlying uh data that is stored in that in that blob or tree or whatever.
01:00:53.199 -->
01:00:57.920So spelling out that hash, um that's a ref.
01:00:57.920 -->
01:01:02.000A branch name um is a ref.
01:01:02.000 -->
01:01:08.320You can modify any other ref with tildes.
01:01:08.320 -->
01:01:13.440For instance, if it's a commit, um tilde goes back one.
01:01:13.440 -->
01:01:20.159Like there was the root commit, and then you made a new commit, and it's uh and there's another name for that commit.
01:01:20.159 -->
01:01:22.639It's the word head in all caps.
01:01:22.639 -->
01:01:23.920Head is a ref.
01:01:23.920 -->
01:01:29.199Head tilde means one commit back from head.
01:01:29.199 -->
01:01:31.599That's the original commit we just talked about.
01:01:31.599 -->
01:01:35.039So head is a ref and head tilde is a ref.
01:01:35.039 -->
01:01:39.840It turns out n it's sometimes not a chain.
01:01:39.840 -->
01:01:48.719Sometimes, you know, like when you merge or when you branch, if you merge, uh a commit can have two parents.
01:01:48.719 -->
01:01:55.119If you branch, then um uh commits have children.
01:01:55.119 -->
01:02:10.000So there are other characters that you can use, like the caret, you know, the thing that's the shift six, um lots of things uh that uh can refer to objects in the object database.
01:02:10.000 -->
01:02:12.079Every one of those things is a ref.
01:02:12.079 -->
01:02:20.000Um there are more complicated things that you can assemble from refs, for instance.
01:02:20.000 -->
01:02:24.880Um you can assemble a ref range.
01:02:24.880 -->
01:02:30.719Um that usually only applies to commits.
01:02:30.719 -->
01:02:35.840Uh and a ref range, there's uh two different forms of it.
01:02:35.840 -->
01:02:43.360Um so you would say old commit ID dot dot new commit ID.
01:02:43.360 -->
01:02:58.800And what that means is all the commits that you're based on in new commit ID, everything that came before you, everything that if you followed the link of parents back in time that you could reach.
01:02:58.800 -->
01:03:02.480Um, and the the word for that is contains.
01:03:02.480 -->
01:03:07.280Uh and then that old commit ID.
01:03:07.280 -->
01:03:20.639So it's everything you can reach from new commit ID, including new commit, but can't reach from old commit ID, including old commit.
01:03:20.639 -->
01:03:22.559So that's you see this a lot.
01:03:22.559 -->
01:03:25.119Git log a dot dot b.
01:03:25.119 -->
01:03:27.760That's everything in B that's not in A.
01:03:28.079 -->
01:03:28.320Right.
01:03:28.320 -->
01:03:29.840A place I've used it.
01:03:29.840 -->
01:03:38.400Um we talked about git diff, and that that shows you the difference between what the file on your disk and the previous commit.
01:03:38.400 -->
01:03:45.280If you just say git diff uh file name, it'll show you the differences, how you've changed the file since it was last committed.
01:03:45.280 -->
01:04:02.239Uh you can also do git diff and then a range of commit IDs so that you can look at the changes, like you know where you're at now, but let's say you want to see what changed between two commit IDs further back in your in your history.
01:04:02.239 -->
01:04:10.079You can do a git diff uh commit ID dot dot git commit ID, and it'll show you those changes from history.
01:04:10.239 -->
01:04:14.239And it's obviously I actually have to tell you something kind of embarrassing.
01:04:14.480 -->
01:04:14.960Yeah?
01:04:15.199 -->
01:04:16.639And that that is this.
01:04:16.639 -->
01:04:35.360Umrdinary human beings want to use that dot dot in git diffs so much uh because the actual syntax is git diff, one commit, another commit.
01:04:35.360 -->
01:04:36.639That's it, no dots.
01:04:36.639 -->
01:04:39.599Um because you don't need the range.
01:04:39.599 -->
01:04:46.079It's not like it's oh it's gonna look at the snapshot from one and compare it to the snapshot from the other.
01:04:46.079 -->
01:04:49.199Like the idea that it's a range is not a thing.
01:04:49.199 -->
01:04:56.159But people do it so much, like they do it more than they do the thing that it was designed to do, yeah.
01:04:56.159 -->
01:04:58.159That they made it work.
01:04:58.159 -->
01:05:03.039Uh and then on top of that, I want to add this.
01:05:03.039 -->
01:05:12.639If you say git diff and you give two commit IDs, and then you say dash dash with spaces around it.
01:05:12.639 -->
01:05:19.599So it's a dash dash all by itself, the thing that says, and now other stuff that aren't options.
01:05:19.599 -->
01:05:20.079Right.
01:05:20.079 -->
01:05:28.800Uh, and then you name a file or directory, it narrows the diff down to just be about that file.
01:05:29.199 -->
01:05:29.920Right, right.
01:05:29.920 -->
01:05:31.119Very handy.
01:05:31.119 -->
01:05:32.800So yeah.
01:05:32.800 -->
01:05:36.880Um I I think we can move on, eh?
01:05:37.679 -->
01:05:38.639Yeah, let's do that.
01:05:38.880 -->
01:05:41.920There's a lot more to refs than what we just talked about.
01:05:41.920 -->
01:05:48.800It's it's uh I encourage the listener to go dig into it, uh, take a look at the man page or look online for the information there.
01:05:48.800 -->
01:06:00.719Uh, but uh once you've made your changes uh locally and uh you want to share them with the world, uh you would push the the changes.
01:06:00.719 -->
01:06:02.079You'd push your commits, right?
01:06:02.079 -->
01:06:03.599Is that am I saying that right?
01:06:03.599 -->
01:06:10.639You you've committed your changes and now you want to push them up to a uh a canonical repo.
01:06:11.039 -->
01:06:16.400Um I think I'm saying Yeah, so there's a couple things to say about this.
01:06:16.400 -->
01:06:27.519One is um Git doesn't have a model in mind for how you're going to use more than one instance of the same repo.
01:06:27.519 -->
01:06:36.639It's a 100% appropriate, more appropriate than a normal person thinks, to just have one git repo.
01:06:36.639 -->
01:06:42.239To go into a directory, get in it, and start editing, and that's all you have.
01:06:42.239 -->
01:06:47.119Uh if that's the case, you'll never say push or pull or any of those things.
01:06:47.119 -->
01:06:47.760Right.
01:06:47.760 -->
01:06:59.280Um another scenario is um everybody has a canonical repo and they're all doing work on this same thing.
01:06:59.280 -->
01:07:14.159For instance, um, Git itself is a project that's shared by everybody, and there is one repo that is the truth about Git, and it lives on GitHub.
01:07:14.159 -->
01:07:23.199Um, and you can fork it into your own copy and then clone that, or you could directly clone it.
01:07:23.199 -->
01:07:32.000Clone is a word you only use when there's already the thing you want somewhere else.
01:07:32.000 -->
01:07:34.559And when you do that, fetches it.
01:07:34.559 -->
01:07:36.960That's it uh it uh yes.
01:07:36.960 -->
01:07:42.800Fetch fetch has specific meanings, but yes, that it turns out that meaning is also true here.
01:07:42.800 -->
01:08:06.320Um so the there's the case of you're not sh working with other people or sharing at all, and then there's this model where um you have a specific what we call upstream repo, the one you came from, and typically that upstream repo has a special name uh r to you.
01:08:06.320 -->
01:08:09.360Uh to you, you often call it origin.
01:08:09.360 -->
01:08:10.880Yeah.
01:08:10.880 -->
01:08:32.479And if you if you have one of these, which is called a remote, um, then you can configure exactly what happens, but you can grab the latest changes that other people have put there, um, people who are just like you and have their own copy on their own machine and they're pushing and pulling.
01:08:32.479 -->
01:08:36.720You can grab their changes, which you do by saying git pull.
01:08:36.720 -->
01:08:45.199You can take your changes and push them somewhere, back, you know, back up to origin, which you do by saying git push.
01:08:45.199 -->
01:08:56.479Um if you have a remote, it turns out you have some additional refs in your repo which have special names.
01:08:56.479 -->
01:09:13.439For instance, if there is a main branch at the canonical repo, then once you fetch from them, you will have a ref in your system, origin slash main.
01:09:13.439 -->
01:09:20.399Now, it counts as a branch, a special branch, a remote branch.
01:09:20.399 -->
01:09:23.279Um you you can't edit it.
01:09:23.279 -->
01:09:37.840If you want to check out um main, you can check out main, and if you didn't already have your own actual local branch, it sees that there is origin main and says, Oh, you meant that.
01:09:37.840 -->
01:09:39.359I'll make you one.
01:09:39.359 -->
01:09:50.239And it makes a brand new branch named main that starts at um origin slash main, the r the commit ID that that refers to.
01:09:50.239 -->
01:10:06.960And it does this magic thing that it uses metadata, which it stores in the config file for your repo, for this repo, that says this branch pushes and pulls to this remote branch.
01:10:06.960 -->
01:10:09.520Um now they're tied together.
01:10:10.399 -->
01:10:16.560That remote branch might be GitHub or or um uh what are the other GitLab?
01:10:16.560 -->
01:10:20.000Uh or you might just run your own Bitbucket or Bitbucket.
01:10:20.000 -->
01:10:26.880Yeah, you might you might just run your own uh repo served up through SSH or HTTP.
01:10:26.880 -->
01:10:33.760Um but yeah, when people talk about cloning from from GitHub or pushing to GitHub, that's what they're talking about.
01:10:34.239 -->
01:10:34.800They are.
01:10:34.800 -->
01:10:38.800Uh now Git itself doesn't enforce this model.
01:10:38.800 -->
01:10:40.560It doesn't have a model, like I said.
01:10:40.560 -->
01:11:01.199So it could be that you and I are connected over SSH, um, and I happen to have a IP address that leads to you, or maybe a name or something, and I know the path that leads to the Git project that you and I are both working on, and there is no the thing that's up on the server has no files.
01:11:01.199 -->
01:11:07.119It's it's essentially just what's in the.git directory, it's just the object database and some other things.
01:11:07.119 -->
01:11:10.399But there's no place to put actual source files.
01:11:10.399 -->
01:11:12.960That's called a bear checkout.
01:11:12.960 -->
01:11:14.000Minus, minus bare.
01:11:14.000 -->
01:11:24.079Um if you and I are both working on a project and it's not bare, we've got actual files, that doesn't matter.
01:11:24.079 -->
01:11:27.760I could still clone your repo.
01:11:27.760 -->
01:11:30.239You would be my upstream.
01:11:30.479 -->
01:11:35.680Um, canonical uh repo and you're pulling for me.
01:11:35.680 -->
01:11:37.039Yeah, you're cloning for the remote.
01:11:37.199 -->
01:11:41.920Or you can I sure could add remotes where we're both looking at each other.
01:11:41.920 -->
01:11:44.000Are these good ideas?
01:11:44.000 -->
01:11:46.000Probably not.
01:11:46.000 -->
01:11:54.159This uh canonical thing on GitHub works pretty good and is almost certainly what you want in most cases.
01:11:54.159 -->
01:11:56.399Yeah, there's funny cases, but okay, whatever.
01:11:56.720 -->
01:12:03.520Now now I I mentioned that uh for my client, I um I I use Git to manage their release.
01:12:03.520 -->
01:12:09.119Uh uh actually have uh Git repo checked out on their server in production.
01:12:09.119 -->
01:12:21.760And when I'm when I'm gonna do some cherry picking, I might have a hot fix and I want to make sure that I can uh that I can uh uh do this cherry pick without a problem, without a a conflict or something.
01:12:21.760 -->
01:12:27.439What I'll do is they've already uh checked out or cloned from GitHub.
01:12:27.439 -->
01:12:37.840I SSH to their machine and I get into the temp directory and I do a clone from their production tree on their on that disk to the temp directory.
01:12:37.840 -->
01:12:43.600And then I apply my my hot fix to that version in temp just to make sure it applies cleanly.
01:12:43.600 -->
01:12:49.439And if it does, then I I go into the production directory and I and I do the cherry pick there.
01:12:49.439 -->
01:12:58.319Uh it's just my little safety thing so that I don't break production by installing something that had a merge conflict or or some other disastrous thing.
01:12:58.319 -->
01:13:02.960Uh that seems pretty awesome.
01:13:02.960 -->
01:13:05.439Well, you taught me that.
01:13:08.399 -->
01:13:13.199Uh I guess uh pushing and pulling, I'll just say one last thing about that.
01:13:13.199 -->
01:13:13.600Yeah.
01:13:13.600 -->
01:13:27.439This is another place where, just like switching branches, it's another place where your loose files that haven't been added or committed yet can get in the way, can obstruct you.
01:13:27.439 -->
01:13:31.199This is another place to use the stash.
01:13:31.199 -->
01:13:32.479Yeah.
01:13:32.880 -->
01:13:33.359Yeah.
01:13:33.359 -->
01:13:42.399You know what we we didn't talk about, and I think we kind of need to, is I don't even have it on our outline, and that is uh merge conflicts.
01:13:42.399 -->
01:13:45.119Oh, we yeah, we do have that.
01:13:45.119 -->
01:13:45.840I'm sorry.
01:13:45.840 -->
01:13:50.399We're gonna talk about merge conflicts in a couple of minutes, and Wolf's got some interesting things to say about that.
01:13:50.399 -->
01:13:55.520Uh, but why don't why don't we go into let's start talking about merging and and that kind of fun.
01:13:55.520 -->
01:13:56.560Okay.
01:13:57.680 -->
01:14:09.199So even if you don't have multiple branches, uh, but you are working with other people, in a way, you do have multiple branches.
01:14:09.199 -->
01:14:18.880Um there is this idea of combining code that were two different paths that the code took.
01:14:18.880 -->
01:14:54.000So an example is uh if you cherry pick a commit from someplace else, if you have two branches and you're ready to incorporate the changes from one branch into the other, if you have been working on main or on develop or whatever, and you pull uh from the remote and the remote has other people's work that is also on that same branch, um, that's like having two branches, their work and your work.
01:14:54.000 -->
01:14:56.880And now you have to combine that work.
01:14:56.880 -->
01:15:05.520Um this is a fundamental problem in every single source code control system.
01:15:05.520 -->
01:15:26.800Uh and there is a thing that happens, and not only is it universal, but it is also the worst and most annoying problem that every source code control system has, and the worst thing about it is it requires human knowledge.
01:15:26.800 -->
01:15:30.800Um, and this problem is merge conflicts.
01:15:30.800 -->
01:15:45.760In a merge conflict, um a good source control code control system, and there are many, um says, well, you both changed this file, but you only changed line 10.
01:15:45.760 -->
01:15:50.800And this code you're trying to merge into it only changed line 50.
01:15:50.800 -->
01:15:52.560I'll just take them both.
01:15:52.560 -->
01:15:53.439No problem.
01:15:53.439 -->
01:16:10.880That might not actually be no problem, because maybe your line says don't run at all, and their line says, um, we absolutely you know, they say something that's logically different, but in totally different places.
01:16:10.880 -->
01:16:12.000Well that merges.
01:16:12.000 -->
01:16:17.199You know, the thing won't run, but you you got what you got.
01:16:17.199 -->
01:16:19.680But the the thing, yeah.
01:16:20.079 -->
01:16:27.520The the the bigger problem for me is uh you changed line 10 and I changed line eight through twelve.
01:16:27.520 -->
01:16:41.920So we both changed overlapping space, and uh uh I I do my uh merge and then you try to you do yours, and and there you get the merge conflict.
01:16:41.920 -->
01:16:46.000Uh it doesn't know what to do because we both changed the same lines.
01:16:46.960 -->
01:17:10.079So the thing that you have to do when you get a merge conflict is your goal is one file that does the thing you want, which is whatever features the one side made that are worth keeping, plus whatever features the other side made that are worth keeping.
01:17:10.079 -->
01:17:17.680And to make that fix, to combine those things, you need knowledge of both sides.
01:17:17.680 -->
01:17:28.319A human being has to look or something that can have knowledge and say, you set it to 10 and I set it to 15.
01:17:28.319 -->
01:17:29.760Is one of those right?
01:17:29.760 -->
01:17:31.920Oh no, it turns out we don't want that thing at all.
01:17:31.920 -->
01:17:33.840What we want is a buffer.
01:17:33.840 -->
01:17:34.720Or or whatever.
01:17:34.720 -->
01:17:36.560Like it's a thing you have to do.
01:17:36.560 -->
01:17:37.920Yeah.
01:17:37.920 -->
01:17:38.720Right.
01:17:38.720 -->
01:17:43.840Um so you have to resolve a mar merge conflict that way.
01:17:43.840 -->
01:17:49.600But this leads to a couple of things that are absolutely worth saying.
01:17:49.600 -->
01:17:57.680There is a category of I don't know, what's the exact opposite of team player?
01:17:57.680 -->
01:18:00.720Um, there's a thing you can do.
01:18:00.720 -->
01:18:10.720You can merge someone else's changes, but when you actually get them, essentially just throw them away.
01:18:10.720 -->
01:18:12.640Or don't even merge.
01:18:12.640 -->
01:18:19.680Just say, oh no, I'm right, and push yours up to the server, completely replacing theirs.
01:18:19.680 -->
01:18:22.960Um, we call that a force push.
01:18:22.960 -->
01:18:27.600What you're saying is, oh, forget everybody else's work.
01:18:27.600 -->
01:18:29.920I mean that's the whole thing.
01:18:29.920 -->
01:18:30.720That's what you're saying.
01:18:30.720 -->
01:18:31.039Yeah.
01:18:31.039 -->
01:18:33.279Forget everybody else's work.
01:18:33.279 -->
01:18:46.720Um that is, first of all, if you're the kind of person who is saying that, probably your work was already not good enough to substitute for their work.
01:18:46.720 -->
01:18:50.399Um so you're not you're probably not a good programmer.
01:18:50.399 -->
01:18:53.039It says more about you than it does about the code, right?
01:18:53.039 -->
01:18:53.920Right.
01:18:53.920 -->
01:18:57.760Uh and number two is yeah, you're not you're not working for the team.
01:18:57.760 -->
01:18:59.039You're not doing the right thing.
01:18:59.039 -->
01:19:05.039So force pushing, usually bad, especially in a team scenario.
01:19:05.039 -->
01:19:09.119And merge conflicts apply to every source code control system.
01:19:09.119 -->
01:19:19.840They are the hardest problem to fix, and um, you know, maybe you know enough to fix it yourself, or maybe you need the other person to come and help you.
01:19:19.840 -->
01:19:21.680Um, it can be annoying.
01:19:21.680 -->
01:19:26.239So that's merge conflicts, and it happens all the time.
01:19:26.239 -->
01:19:30.880It happens when you pull the branch you're on and somebody else did work.
01:19:30.880 -->
01:19:35.680It happens when you're doing an actual merge, putting develop into main.
01:19:35.680 -->
01:19:38.319It happens when you are cherry picking.
01:19:38.319 -->
01:19:46.319I just want this bug fix that I put as a hotfix for that release back in March, and you're bringing that to the tip of main.
01:19:46.319 -->
01:19:58.399Uh, it happens um when you do a thing called rebasing, which I'm not sure we're gonna talk about, but it's uh a special kind of combining.
01:19:58.399 -->
01:20:03.119Um Anyway, I think that's everything we need to say about combining.
01:20:03.600 -->
01:20:03.840Yeah.
01:20:03.840 -->
01:20:06.399Okay, so we've got a couple of advanced topics.
01:20:06.399 -->
01:20:10.079We're already an hour and twenty minutes into this, so I don't know how deep we're gonna go into these.
01:20:10.079 -->
01:20:10.960There's a few of them.
01:20:10.960 -->
01:20:12.479We should at least mention them.
01:20:12.479 -->
01:20:16.000Uh you want to talk about uh those advanced things?
01:20:16.800 -->
01:20:17.359Sure.
01:20:17.359 -->
01:20:46.479Um w a thing that you're gonna hit on a team is you're almost certainly people don't just no matter what, uh if you're using a uh filled out web UI system to manage your canonical repo, then when somebody says, my change is ready to be released, I want it to go on to main, um, they're not just gonna merge it to main because who who the hell trusts them?
01:20:46.479 -->
01:20:56.640They're gonna make a thing that, depending on what system you're using, but it's the same thing, is called either a pull request or a merge request or something.
01:20:56.640 -->
01:21:05.039And the web UI understands that this is going to be a merge, some criteria has to be met.
01:21:05.039 -->
01:21:14.079Usually your team has to approve it, has to go over it, and you need at least two of the other engineers to say, yeah, this is good enough.
01:21:14.079 -->
01:21:22.560And the web UI, looking at the canonical repo, has to be able to tell, oh, and there won't be any conflicts.
01:21:22.560 -->
01:21:24.720There's a couple ways it can tell that.
01:21:24.720 -->
01:21:28.800And sometimes the tests have to pass, whatever.
01:21:28.800 -->
01:21:35.760It's not a git function, it's a function of GitHub or GitLab or BitBucks.
01:21:35.760 -->
01:21:37.279Pull requests are not git.
01:21:37.279 -->
01:21:38.079Or whatever.
01:21:38.479 -->
01:21:42.560It's GitHub or or whoever's managing your Git repo.
01:21:42.560 -->
01:21:43.920Exactly.
01:21:44.239 -->
01:21:44.560Okay.
01:21:44.560 -->
01:21:50.319Uh another thing, this is a superpower, no question.
01:21:50.319 -->
01:22:14.079It's the super if you have managed your commits correctly, um, and you've done the thing I said where each commit is a full, complete, contained thing, and you've worked hard to make them be a straight line, but now you've suddenly noticed a problem, a bug.
01:22:14.079 -->
01:22:15.760Something isn't right.
01:22:15.760 -->
01:22:25.359And you know for sure it's wrong here in the latest version, but you know for sure it was right in March.
01:22:25.359 -->
01:22:26.399Yeah.
01:22:26.399 -->
01:22:30.800You can do a thing called Git Bisect.
01:22:30.800 -->
01:22:41.920And what Git Bisect does is with varying degrees of success, and you can automate it and you can make it run tests by itself and whatever, but at its base, it does this.
01:22:41.920 -->
01:22:44.880You tell it where to start.
01:22:44.880 -->
01:22:46.720What is the bad commit?
01:22:46.720 -->
01:22:54.319The one that is the earliest you know of that has wrong behavior, and you tell it what is the good commit?
01:22:54.319 -->
01:23:00.479What is the very most recent commit, and this is gonna be older than the bad one.
01:23:00.479 -->
01:23:04.399If it's not, that means the problem's already fixed, so forget it.
01:23:04.399 -->
01:23:09.199Uh so March is the good commit, and now is the bad commit.
01:23:09.359 -->
01:23:19.840And once you've told it that, well, you can say what you're saying is it worked in March and now it doesn't, and I want to figure out which commit caused it to not work.
01:23:20.479 -->
01:23:21.520That is the problem.
01:23:21.520 -->
01:23:23.439That is what we're gonna find the answer to.
01:23:23.439 -->
01:23:40.720And so get bisect, uh, I think it's start, uh, after you've said git bisect good and git bisect bad on the ones that meet that criteria, and you can actually give those different names if that's not the thing that's gonna make it easy for you.
01:23:40.720 -->
01:23:46.319If, for instance, it's you know, does logging or has a red board or whatever.
01:23:46.319 -->
01:23:48.399You can make the command be what you want.
01:23:48.399 -->
01:23:57.039Um git starts up and git finds the middle of that list and checks that out.
01:23:57.359 -->
01:23:57.680Right.
01:23:57.920 -->
01:24:05.680Um and if you have set it to run a test script, it'll run that test script on the thing it just checked out.
01:24:05.680 -->
01:24:18.399Um and if it doesn't need human input to decide whether that was right or wrong, it'll know that it was right or wrong from the test script, and it will then take the half that is left.
01:24:18.399 -->
01:24:21.119Well, that one was good, so it must be newer.
01:24:21.119 -->
01:24:23.199So it's now between that new one.
01:24:23.199 -->
01:24:26.880Yeah, it's doing a binary search through your commits.
01:24:26.880 -->
01:24:28.800That's exactly what it's doing.
01:24:28.800 -->
01:24:29.600That's so cool.
01:24:29.600 -->
01:24:38.640If you don't write a test for it and make it automatic, then yeah, you have to look and you have to say, oh, this one's good or this one's bad.
01:24:38.640 -->
01:24:44.640Um and that'll narrow its focus to the range where the the bad commit must be.
01:24:44.640 -->
01:24:56.960Uh, but the instant you decide whether it's good or bad, and you say so, get bisect good, it instantly finds the next commit to check out and does it, and you're set to test again.
01:24:56.960 -->
01:25:07.680A hundred commits could be wrong in this range, and it takes, you know, maybe six tests or something to find the bad one.
01:25:07.680 -->
01:25:16.960And when it has found the bad one, it leaves you there and prints out the information, the commit ID that was wrong, and you can look at the diff.
01:25:16.960 -->
01:25:30.239And by the way, if you made your commits the way I said, that commit is probably going to be fairly small, and whatever is wrong, it's probably gonna stand out in that diff.
01:25:30.239 -->
01:25:35.760Um bisect is a reason to make good commits.
01:25:36.079 -->
01:25:36.720Yep.
01:25:36.720 -->
01:25:38.800It's one of the reasons.
01:25:38.800 -->
01:25:40.159It's fantastic.
01:25:40.159 -->
01:25:44.800All right, quickly, uh, you wanted to mention work trees.
01:25:45.600 -->
01:25:47.039I absolutely do.
01:25:47.039 -->
01:25:49.520Uh so what is a work tree?
01:25:49.520 -->
01:25:53.279Um, let me give you a sense first I'll tell you what they are.
01:25:53.279 -->
01:26:25.279A work tree, if you're doing something to the canonical repo, um, and in one case, you specifically want the release branch, and you're going to do a build, and a build takes eight hours, maybe a thing for you to do is just clone it twice and set one clone to the release branch and one clone to the development branch, turn make the release branch start doing its build, and you just keep working.
01:26:25.279 -->
01:26:26.800Maybe that's what you want to do.
01:26:26.800 -->
01:26:31.520But a modern alternative is to make a work tree.
01:26:31.520 -->
01:26:41.039And what a work tree is, is it's a real physical working directory, just like a clone would be.
01:26:41.039 -->
01:26:59.600Except instead of having a um dot git directory with the object repository in it, which by the way is at least half the total size of your complete um c working copy.
01:26:59.600 -->
01:27:04.239Half of it is the files you have checked out and half of it is the object directory.
01:27:04.239 -->
01:27:12.800Instead of a.git directory, it has a.git file, which is uh sort of like a symbolic link.
01:27:12.800 -->
01:27:18.880It's a text file that has a path back to the original repo.
01:27:18.880 -->
01:27:20.880They're they share.
01:27:20.880 -->
01:27:37.680Um if you make a change in some branch, if you pull or fetch, whatever you do, anywhere in any of those, the thing that gets updated is the m the objects associated with the uh principal uh clone.
01:27:37.680 -->
01:27:45.199And the working directory just automatically gets all that stuff, but it's half the size or smaller.
01:27:45.199 -->
01:27:48.399Um there are some restrictions.
01:27:48.399 -->
01:27:58.720Um if you have a work tree, um only and let's count the original clone as a work tree for a second.
01:27:58.720 -->
01:28:06.000Of all the work trees, only one of them can have a specific branch checked out at a time.
01:28:06.000 -->
01:28:18.239You can make a work tree check out any branch you want, but multiple work trees among that set, there can never be a case where one of those is checked out to the same branch as another.
01:28:18.239 -->
01:28:26.640Um but work trees, the a great thing about work trees for me is because I'm working in Python, there are virtual environments.
01:28:26.640 -->
01:28:37.920In a work tree, I don't have to rebuild the work the virtual environment every time I switch branches if that branch introduces new version requirements.
01:28:37.920 -->
01:28:41.439Um that's all I'm gonna say about work trees at the moment.
01:28:41.439 -->
01:28:43.359It it can help you.
01:28:43.359 -->
01:28:46.399It's a really good thing, it's worth looking up.
01:28:46.399 -->
01:28:52.319Um there is one last um advanced topic I want to talk about.
01:28:52.640 -->
01:28:53.359This is what I like.
01:28:53.359 -->
01:28:54.800I like it a lot.
01:28:55.439 -->
01:28:59.520Um I'm all about reducing friction.
01:28:59.520 -->
01:29:05.119Um and there's lots of points of friction.
01:29:05.119 -->
01:29:16.399You have to remember to run the tests, you have to remember to type check your code, you have to remember um to run the linter to see if it's all formatted.
01:29:16.399 -->
01:29:19.680You have to remember to check the spelling everywhere.
01:29:19.680 -->
01:29:26.880You have to remember to look for white space at the end of all the lines or extra trailing new lines.
01:29:26.880 -->
01:29:29.680You know, a file should end with exactly one.
01:29:29.680 -->
01:29:54.880Well, um you can install pre-commit in any Git repo and say what checks it needs to run, and those things become part of a list of things that happen automatically without you um doing anything before a commit will be accepted.
01:29:54.880 -->
01:30:03.119So you add all the stuff you want, and you say get commit, blah blah blah, and pre-commit takes over and says, guess what?
01:30:03.119 -->
01:30:08.800You had too many um trailing, like new lines, um, you can't commit.
01:30:08.800 -->
01:30:11.439Not you can't commit this file.
01:30:11.439 -->
01:30:13.039You can't commit.
01:30:13.039 -->
01:30:15.119Um everything is refused.
01:30:15.119 -->
01:30:21.039Um there are behaviors you can use to make the sequence of steps you have to take shorter.
01:30:21.039 -->
01:30:31.439Like, for instance, uh you can ask pre-commit to run by itself without actually being part of the commit, and then add everything once you know it already passes.
01:30:31.439 -->
01:30:34.800Um but pre-commit, super useful.
01:30:34.800 -->
01:30:36.000I always use it.
01:30:36.000 -->
01:30:37.520You have good experiences, Jim?
01:30:37.680 -->
01:30:40.640Uh yeah, I've only been using it for maybe six weeks.
01:30:40.640 -->
01:30:46.640Um and I uh what it does, you you do a git add to add your file.
01:30:46.640 -->
01:30:48.479Let's say you're just working on one file.
01:30:48.479 -->
01:30:52.720You do a git add, and then you go do git commit, and it runs these tests.
01:30:52.720 -->
01:30:56.560Uh, and in my case, it might find uh trailing white space.
01:30:56.560 -->
01:31:00.880That's that's a it's one of those things that really annoys me is leaving trailing white space.
01:31:00.880 -->
01:31:08.479So it it not only finds the trailing white space, but it modifies your file and removes the trailing white space.
01:31:08.479 -->
01:31:20.479So now you're left there with something in the in the staging area uh ready to commit, and the same file in your current working directory with the that's been modified, it's had the trailing spaces removed.
01:31:20.479 -->
01:31:22.960So you have to git add that again.
01:31:22.960 -->
01:31:29.920So now you've done two ads on the same file, and then you can do your git commit and it'll run the tests again.
01:31:29.920 -->
01:31:36.399Uh, but this time it'll succeed because there are no more trailing white space uh on on the on the lines.
01:31:36.399 -->
01:31:38.720Um and I like it.
01:31:39.359 -->
01:31:41.199And there are ways you can shorten up.
01:31:41.199 -->
01:31:46.000You don't if you run it before you do the ads, if you say pre-committee.
01:31:46.079 -->
01:31:47.279Yeah, I should do that.
01:31:48.399 -->
01:31:50.399Then then you only have to add once.
01:31:50.399 -->
01:32:03.840But um if it's the case that um your ads are special, you didn't want to commit the whole thing, you were gonna use ad interactive, um, then the way Jim is doing it is the right way.
01:32:04.319 -->
01:32:06.399And it's uh and a lot of these tools.
01:32:06.399 -->
01:32:10.079I'm scratching the surface of what it can do.
01:32:10.079 -->
01:32:13.760For me, it's primarily uh removing trailing white space.
01:32:13.760 -->
01:32:15.199I need to put some tests in there.
01:32:15.199 -->
01:32:17.439We we are not a test-driven shop.
01:32:17.439 -->
01:32:26.000Uh we should be, and this is our chance to put some tests in there to make sure that the code passes some level of tests before you actually commit it.
01:32:26.000 -->
01:32:28.479But it's it's way cooler.
01:32:28.479 -->
01:32:28.960Yeah.
01:32:28.960 -->
01:32:33.119All right, man, we've been talking for an hour and 30 minutes or so.
01:32:33.119 -->
01:32:37.840Um we uh I think we've covered all the topics I wanted to cover.
01:32:37.840 -->
01:32:41.279One final thing is well, Git is an awesome tool.
01:32:41.279 -->
01:32:44.560Uh tell us about some of the alternatives to Git.
01:32:45.359 -->
01:32:54.399Um, well, first of all, um there that just like anything else, there's a lot of people for whom Git is a religion.
01:32:54.399 -->
01:33:01.520Um it's not a tool, it's a um, I don't even know what to call it, a way of life.
01:33:01.520 -->
01:33:06.560I happen to be knowledgeable about Git, but it's just a tool to me.
01:33:06.560 -->
01:33:11.439If something better comes along, I'm I'm gonna use that.
01:33:11.439 -->
01:33:16.479Um, just like I am with everything else, as you well know and kind of despise.
01:33:17.439 -->
01:33:20.800And I and I tend to lag behind quite a bit.
01:33:21.520 -->
01:33:30.239Uh so in the old days we used things like CVS, uh, which was uh lacking in a lot of ways.
01:33:30.239 -->
01:33:31.600I'm not gonna go into them.
01:33:31.600 -->
01:33:41.680Perforce, which is still in use today because Perforce can do some really important things that Git can't, doesn't want to, isn't convenient to do.
01:33:41.680 -->
01:33:47.920Perforce is great with big files and binary files and things like that.
01:33:47.920 -->
01:33:51.439Subversion uh was a big deal.
01:33:51.439 -->
01:33:59.359Um one of the things that subversion brought into the world was this idea of easy branching.
01:33:59.359 -->
01:34:08.479Um now the way Git and Subversion branch is very different, um, and Git's way I feel like is better, but subversion was a huge jump.
01:34:08.479 -->
01:34:13.680Uh there's Mercurial, which was invented right around the same time as Git.
01:34:13.680 -->
01:34:16.960Uh Mercurial is for the same reason because it's by the way.
01:34:16.960 -->
01:34:18.640Yeah, for the same reason.
01:34:18.640 -->
01:34:27.600Uh Mercurial is written entirely in Python, so if you wanted to do something, super easy to fix and make it do that thing.
01:34:27.600 -->
01:34:32.800Uh the people who wrote Mercurial, I I don't know.
01:34:32.800 -->
01:34:49.039But the places where I encounter this, um the people who are on the Mercurial side, and as far as I know, none of these are creators, um, are angry that Git somehow is the winner.
01:34:49.039 -->
01:34:51.840Um and winner is not a good word.
01:34:51.840 -->
01:34:55.279Git has the most momentum at this moment.
01:34:55.760 -->
01:34:59.520But new things businesses have launched around it.
01:34:59.920 -->
01:35:01.199Yeah, that is true.
01:35:01.199 -->
01:35:05.199Uh new things are coming around.
01:35:05.199 -->
01:35:12.960Um I'm gonna name some that seem like they could be something, I don't know, and some that probably won't.
01:35:12.960 -->
01:35:18.800Um there's this thing, um, I'm just gonna start at the top, jujutsu.
01:35:18.800 -->
01:35:25.840Um, and the thing about jujutsu is there are hard things about git.
01:35:25.840 -->
01:35:35.359The guy who wrote jujitsu started with the idea that, okay, git.
01:35:35.359 -->
01:35:36.399Yeah.
01:35:36.399 -->
01:35:37.680But not hard.
01:35:37.680 -->
01:35:39.760Let's do git, but not hard.
01:35:39.760 -->
01:35:50.960So he works on top of a git repo, and my understanding is that it's possible, although maybe not implemented, to work on top of others.
01:35:50.960 -->
01:35:58.640But things that he thought in the model were too hard, he changed the way it looks to a user.
01:35:58.640 -->
01:36:03.920But apparently to in jujitsu, I could be using git.
01:36:03.920 -->
01:36:11.600The canonical repo could be a git repo, and locally you could be using jujitsu, and I would never know.
01:36:11.600 -->
01:36:13.039That's the promise.
01:36:13.039 -->
01:36:19.279But in git, you stage, you build, you craft your commit, and then you make it.
01:36:19.279 -->
01:36:23.119In jujitsu, you're always at a commit.
01:36:23.119 -->
01:36:32.960You can undo things, um, but you only move on to the next commit when you say, Oh, oh, and by the way, um, yeah, that commit's complete.
01:36:32.960 -->
01:36:34.399But there's no adding.
01:36:34.399 -->
01:36:36.399Everything is already a commit.
01:36:36.399 -->
01:36:39.600It just takes saying that you're moving on to be that thing.
01:36:39.600 -->
01:36:42.800Um so jujitsu is worth exploring.
01:36:42.800 -->
01:36:44.000It's interesting.
01:36:44.000 -->
01:36:53.199And on uh Mastodon, I see people that I consider to be super smart people, and they are raving about jujitsu.
01:36:53.199 -->
01:36:57.119And it is not jujitsu, it is jujutsu.
01:36:57.119 -->
01:37:00.239J-U-J-U-T S U.
01:37:00.239 -->
01:37:01.199T S U.
01:37:01.199 -->
01:37:02.079That's right.
01:37:02.079 -->
01:37:06.399Um, of course, there's Fossil from the SQ Light guy.
01:37:06.399 -->
01:37:07.920I never hear about fossil.
01:37:07.920 -->
01:37:10.319I don't know if anybody is using it but him.
01:37:10.319 -->
01:37:12.000It may be just him.
01:37:12.000 -->
01:37:15.279There is sapling.
01:37:15.279 -->
01:37:19.039I don't know anything about sapling at all.
01:37:19.039 -->
01:37:21.760Um, so can't tell ya.
01:37:21.760 -->
01:37:25.920And there's uh I don't even know how to say this, but PyJoule P-I-J-U-L.
01:37:25.920 -->
01:37:27.840I've heard about that.
01:37:27.840 -->
01:37:34.399I hear some good things, I don't see real broad acceptance, but it's new.
01:37:34.399 -->
01:37:36.880It has learned things from Git.
01:37:36.880 -->
01:37:39.199It might be interesting.
01:37:39.199 -->
01:37:42.399Um There's those four things.
01:37:42.399 -->
01:37:45.359Uh and it's just like anything.
01:37:45.359 -->
01:37:50.960Like like languages, like cars, like everything.
01:37:50.960 -->
01:37:54.720Um Git is constantly changing.
01:37:54.720 -->
01:37:58.079New things get added, old things get deprecated.
01:37:58.079 -->
01:38:01.119Um learn it.
01:38:01.119 -->
01:38:02.720Keep learning it.
01:38:02.720 -->
01:38:10.800Um, and if something better comes along and the cost to switch fits into the ROI equation.
01:38:10.800 -->
01:38:11.600Yep.
01:38:11.600 -->
01:38:14.880Then then maybe it's time to switch.
01:38:14.880 -->
01:38:15.600Yeah.
01:38:15.760 -->
01:38:20.079Alright, so that's a long, uh uh great episode.
01:38:20.079 -->
01:38:22.079Uh let's let's wrap this up.
01:38:22.079 -->
01:38:24.880What do you think the takeaways are from this episode?
01:38:25.600 -->
01:38:27.359I think there's only one takeaway.
01:38:27.359 -->
01:38:43.600And that takeaway is Git gives you a place where your work is safe and you have room, because it's safe, and tools, to experiment.
01:38:43.600 -->
01:38:47.279Um That's what that's what Git is all about.
01:38:47.279 -->
01:38:59.600The time machine that can take you play back to before the experiment failed, the um reproducible releases, the easy way to find fixes, the safety.
01:38:59.600 -->
01:39:02.239Um that's what git is about.
01:39:02.239 -->
01:39:04.720I there is a thing we we should mention.
01:39:04.720 -->
01:39:05.600Yes.
01:39:05.600 -->
01:39:12.640And that is um, I want to say our friend, Julia Evans.
01:39:12.640 -->
01:39:18.079I don't think I've earned the right to say our friends because I don't think she knows who I am from Adam.
01:39:18.079 -->
01:39:39.039But uh Julia Evans uh from Wizard Zines, um, a super, super smart uh computer professional who knows lots of stuff about lots of stuff and teaches it to other people, which means she knows it even better than you thought she knew it because she knows it well enough to teach it.
01:39:39.039 -->
01:39:57.920And she teaches it with these hand drawn, illustrated, what she calls zines, um, that not only tell you what you need to know, but tell you in a way you can uh comprehend it and and move forward.
01:39:57.920 -->
01:40:02.319Um I Have every single one of her zines.
01:40:02.319 -->
01:40:04.720I have learned stuff from everyone.
01:40:04.720 -->
01:40:07.199Um man, she's great.
01:40:07.520 -->
01:40:08.560Yeah, they're fantastic.
01:40:08.560 -->
01:40:15.520We will include a link to her site and specifically the the Git zine in our show notes.
01:40:16.000 -->
01:40:17.119There's actually two.
01:40:17.119 -->
01:40:22.079Uh the the the specific one about git is called How Git Works.
01:40:22.079 -->
01:40:23.760Umrigor.
01:40:23.760 -->
01:40:26.159Everybody should have this zine.
01:40:26.159 -->
01:40:27.600How GitWorks is great.
01:40:27.600 -->
01:40:33.039And then she has an older one, um, which she might have done in collaboration.
01:40:33.039 -->
01:40:40.640Uh it is called, uh, and I'm gonna just say the title, even though it's slightly uh expletive, Oh shit, git.
01:40:40.640 -->
01:40:46.079Um and it talks about when bad things happen and what to do about it.
01:40:46.560 -->
01:40:53.520And I know recently she's taken on a project of of uh uh updating the Git man pages.
01:40:53.520 -->
01:40:55.680She's working quite a bit on that.
01:40:55.680 -->
01:40:59.199So yeah, she knows this stuff and you can learn from her.
01:40:59.199 -->
01:41:00.479Uh so check that out.
01:41:00.479 -->
01:41:03.119Like I said, we'll include a link in the show notes.
01:41:03.119 -->
01:41:05.199Uh so that takes us to the end.
01:41:05.199 -->
01:41:09.279I want to thank everybody who's listened, uh, all of our friends out there.
01:41:09.279 -->
01:41:11.279Uh and Wolf, thank you.
01:41:11.279 -->
01:41:13.680This is uh some great, great information.
01:41:13.680 -->
01:41:17.920You've been a mentor to me uh for this and many other things.
01:41:17.920 -->
01:41:26.640And uh uh I think we've had a chance today to uh share some of that knowledge, uh things that I learned uh from the master.
01:41:26.640 -->
01:41:28.800So thanks everyone for listening.
01:41:29.680 -->
01:41:34.479You know, you you mentioned that Git was invented in 2005.
01:41:34.479 -->
01:41:35.199Yeah.
01:41:35.199 -->
01:41:42.319I I'm not a hundred percent sure that I started using Git in 2006.
01:41:42.319 -->
01:41:43.359Yeah, earlier.
01:41:43.359 -->
01:41:45.359It might have been 2007.
01:41:45.359 -->
01:41:45.920Yeah.
01:41:45.920 -->
01:41:47.279Uh but I've been using it for a while.
01:41:47.600 -->
01:41:48.479A lot longer than me.
01:41:48.479 -->
01:41:52.000Anyway, thank you for for uh sharing that knowledge with us.
01:41:52.000 -->
01:42:04.399Uh as always, uh we have show notes at the end that include uh links uh this time to Julia Evans' work and uh links to our webpage.
01:42:04.399 -->
01:42:09.760And uh uh if you want to send us feedback, we would love to have your feedback.
01:42:09.760 -->
01:42:14.640Uh send it to runtime uh uh feedback at runtimearguments.fm.
01:42:14.640 -->
01:42:17.199Uh you can contact us on Mastodon.
01:42:17.199 -->
01:42:19.279All that information is in the show notes.
01:42:19.279 -->
01:42:22.079So in your podcast player, take a look at the show notes.
01:42:22.079 -->
01:42:23.520You'll see all that kind of stuff.
01:42:23.520 -->
01:42:25.600So uh thank you.
01:42:26.079 -->
01:42:27.680Don't forget to mention the transcript.
01:42:27.920 -->
01:42:29.920Uh yes, we're doing transcripts now.
01:42:29.920 -->
01:42:34.560I have uh done transcripts for all the past episodes.
01:42:34.560 -->
01:42:42.079Um, some of them aren't that great because the tool we're using isn't perfect, but it makes us Googleable, which is good.
01:42:42.079 -->
01:42:44.239Um uh so yeah.
01:42:44.239 -->
01:42:45.760So thanks everybody.
01:42:45.760 -->
01:42:54.399Um look forward to uh uh doing this again in a couple of weeks, and uh tell all your friends how much you enjoyed this podcast.
01:42:54.399 -->
01:42:56.560So thanks, Wolf.
01:42:56.960 -->
01:42:58.000Uh my pleasure.
01:42:58.000 -->
01:42:58.960This is fun.
01:42:58.960 -->
01:43:00.640Hi, everybody.