Up and Running with Git Transcripts
Chapter: Introducing Git
Lecture: Why use GUIs for git?

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Why do we want these GUI tools for our git work?
0:05 Well, the same reason that I might use a proper editor rather than no pad
0:08 or text edit to write python code,
0:11 but let's expand on that. Now.
0:13 I realize you might not know anything about GIT.
0:16 So I'm gonna show you three commands real quick.
0:19 Just follow along. You don't have to be able to do them or anything.
0:22 Let's imagine you've written some code.
0:24 We're here in this gray box,
0:25 the terminal or command prompt and I want to tell git these changes.
0:29 I just did I'm ready to commit them and then share them with my team.
0:33 Why do we need GUI's? Because look,
0:35 it's so easy. You type git add . and you say cool,
0:38 three files added and then you want to actually commit them.
0:43 So git commit -m, give a description like latest images from the UI
0:47 Review those get checked in.
0:49 That seems to have worked and now we want to share them with our team will
0:53 do a git push up. It goes everything succeeded.
0:58 See that's easy, Michael, why do I need to do this?
1:01 Why? Why don't I why do I need these GUI tools?
1:03 Why can't I just do this?
1:04 And to be fair, if you want to,
1:06 you can. But let me show you some awesome stuff that you get by working with
1:10 the UI tools that I keep proposing are a good idea.
1:13 Both for beginners and for experts.
1:16 Here we are in VS code.
1:18 I've checked out the c python source code.
1:20 This is the runtime for python from git hub.
1:24 And I've opened up one of the larger,
1:26 more important files in c python called C eval.C.
1:30 There's a huge loop that rips around and basically runs every statement of python in any
1:35 python program And this is part of it.
1:38 Now notice online 5,509 right there,
1:41 there's this little odd gray text.
1:45 What is that? That doesn't look like source code.
1:48 This is coming from something called git lens which is part of and be added to
1:53 visual studio code and it says right there,
1:56 Guido Van Rassum made a change in source control 30 years ago.
2:02 And what did he change here?
2:03 What part of? Why did he why was he in this section?
2:06 We'll he said changes so that user defined classes can implement something or other.
2:12 That's the commit message from when he checked in that code 30 years ago.
2:17 And just as I move through this piece of software,
2:21 visual studio code will tell me here is the last person that touched this line and
2:26 why they made the changes that they did there.
2:29 You don't get that on the terminal,
2:30 do you? What about the statuses of files?
2:34 Well I'm here in my editor this time.
2:36 I'm in PyCharm and notice there's some colors going on.
2:40 I've got an app.py and install.py and the setup.py and
2:45 they have these different colors. Those are version control or git colors.
2:49 They tell us about the status of those files with regard to our Git hub repository
2:53 That PyCharm understands app.py is blue because it was previously in the
2:59 repository but it's changed. Setup is green because it's new but added ready to be
3:05 committed and install.py is red because it's neither known by git or ready to
3:11 be committed. It's basically untracked by
3:14 git you see that there, you also see it up here.
3:16 So as you're writing code you're like,
3:17 oh something about app.py has changed just as you look at the project.
3:23 Super cool. What about visualizing those changes?
3:26 You might wonder. Well it said that changed.
3:29 How did it change? We can go to that section up there and if we
3:32 want to know the difference is what has happened.
3:34 Just double click app.py and boom PyCharm busts over into this side by
3:40 side diff view And in the yellow box you can see on the left the
3:45 old stuff. The right the new stuff says on line 19.
3:49 We've written two lines of code in a blank line.
3:51 It says register logging, logging enabled.
3:54 Oh cool. So the change of that blue file is that we've enabled,
3:59 logging all of this stuff is immediately accessible to us because of reason UI tools.
4:06 You want to understand how all these different branches fit together,
4:10 parallel feature branches and stuff. Look at all the colors in the history and the
4:14 exploration here, you can see like some webcast registration recently had stuff moved over from
4:20 the blue branch which is the master branch or main branch and it hasn't yet been
4:27 committed. Its changes but it's basically in sync with what is happening here.
4:31 I can tell you that immediately by looking at source tree and it shows me how
4:37 all these branches fit together again.
4:40 Not so easy on the terminal.
4:43 Finally, let's talk about merging.
4:44 If you make these changes says I'm going to have to do a git pull,
4:49 get some new stuff maybe either because I worked on a branch and then another branch
4:55 I want to bring these together that sort of parallel work I'm doing or the
4:59 team made some changes. I need to bring it in.
5:01 You might get this morning merge conflict better,
5:05 better fix those. How do I fix them?
5:07 Well, it's a little bit tricky.
5:08 You edit them, find a bunch of double arrow stuff,
5:12 you might even end up in something that looks like this that is running vim for
5:15 reasons you're not totally sure about it says you encountered emerged conflict kind of leaves you
5:20 out of context, you're just supposed to write some messages about resolving it.
5:25 So it's not the best experience,
5:28 you can set up some GUI merge tools and diff tools that are going to be really
5:31 awesome actually, even from the command prompt or terminal,
5:34 that's part of the final chapter.
5:36 The tips and tricks. Last advantage of GUI's that I want to just highlight
5:41 now. There are more but just to highlight now is viewing the changes of a
5:45 file over time. So we're back in c python,
5:47 we're back in visual studio code.
5:50 And one of the things we can say is say I want to see everything that
5:55 happened to this file over time and be able to coordinate.
6:00 So for example, there's two things on the right hand side here,
6:04 the far right is the code that we were talking about before,
6:06 but on the left, this is what's called git blame and you can see there's
6:11 an icon for the user, there's a 22 years ago or 7 years ago for
6:16 the time ago and then the message and the line it applies to.
6:19 So for example, online 5322 Thomas Worters said apply sf patch,
6:25 whatever, adding import module 22 years ago.
6:29 So then I can click on Thomas and see the other places in the file.
6:33 He made changes 22 years ago when he was also doing that fix and you can
6:39 just explore and quickly click around through our app through our code and see what who
6:47 who has been in this file.
6:48 What changes have they been making and what change in one part is related to another
6:54 change in another part. All of these things are incredibly accessible and easy as long
6:59 as using the right tools, so that might be a little bit long winded for
7:03 you. But I also wanted to highlight just some of the awesome things that we're
7:06 going to get to as we go through this course, using some of these tools.