Effective PyCharm (2021 edition) Transcripts
Chapter: Source control
Lecture: Editor level source control

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's jump back into PyCharm and actually work with some code and see what we
0:04 can do with Git and the Source code integration.
0:08 First thing to notice is all the files over here are white.
0:12 That means that they're checked into the repository.
0:14 They're not ignored. It would be this color they're not modified they would be blue
0:18 they're not new they would be green.
0:21 So let's go down here and just make some changes.
0:23 So for example let's say that this is going to be the talk python podcast downloader
0:29 And let's see down here this is displaying an individual result or getting an episode
0:37 and then displaying the results. So I'll go and change these.
0:40 Here's let's just say show episode details given an episode id
0:43 But we can come down here and we create a function and def show
0:48 episode details given an episode id which is an integer.
0:55 I'll just put that there and instead of doing that let's call show up.
0:59 So details and pass an episode id.
1:02 little bit of cleanup and or good to go.
1:06 So this is looking really nice.
1:08 Let's just make sure it runs sure enough.
1:13 Our show details works are little header at the top.
1:17 We can scroll way back through all these episodes.
1:19 There we go. We'll show that we've got our new title but if you look
1:24 carefully you'll notice some interesting things.
1:27 So first of all as we made changes notice program turned blue that means it was
1:32 in source control and now it's different.
1:35 It's been changed since then. But look in the gutter over by these line numbers
1:41 we got some colors over here.
1:43 We've got bluish, we've got greenish and brownish.
1:48 They're pretty subtle. So those are Source control items.
1:52 So let's click on this one.
1:53 So what we get. So check this out.
1:55 It shows you the changes right in line says,
1:57 Okay, the line online 12 says talk python podcast downloader.
2:02 But what it used to be is there used to be spaces,
2:05 see how it highlights that blue.
2:06 That's like a selection says there used to be spaces instead of talk python above and
2:10 podcast downloader. We can do all sorts of things.
2:12 We can sort of jump from this.
2:14 Change to this. Change to this.
2:15 Change such a small file. It doesn't matter.
2:17 But if you were on a huge file and you wanted to review all the changes
2:20 maybe that's useful. We could say,
2:22 you know what, I just want it back the way it was.
2:24 I could just click that and reverse.
2:25 Not the entire file, but just that the particular lines right now.
2:29 You see one. But in another situation you might see multiple lines.
2:33 Right? We just change it right here.
2:36 We can copy the old version but we copy that and paste it down here.
2:40 There's the old version and we can pull down the changes and create what's called a
2:47 changeless, which allows us to stack up the changes and commit them as a group
2:50 Okay, so we have our changes here.
2:53 This section. We've added new lines,
2:56 we've added this bit here and it used to be that.
3:00 And then down here these sections have just moved around.
3:03 Okay, so again, really,
3:05 really cool stuff. We can also like this to show a larger def a full
3:09 screen def like this. Maybe that's not so interesting.
3:12 How about this one? There you go.
3:15 You can see we started out with the code just inside the loop and then we
3:18 create a function and we're calling the function gives you a real good idea of what's
3:21 going on in that section. So the actual editor integration for source control is fantastic
3:27 Another thing we can do is we can click on this and because we're in
3:32 git we have all these git operations on this particular file.
3:35 So we can just hit show diff and it'll show you the entire def not just
3:39 for a particular line but for this file compared against what's in the repository versus what
3:44 we've written been written. So there you can see all the changes all together.
3:49 Super, super cool. You can go over here and see in the editor exactly
3:53 what has changed notice over here on the right as well.
3:56 You can see these sections right there and it shows you it would be much more
4:00 useful in a large file but you can see as if this was a really large
4:03 file, you can see all the way down here like in this section there have
4:06 been some changes to the file that need to be checked out.
4:09 You don't get the coloration to indicate what kind of changes just there were source changes
4:14 since the last check in really,
4:16 really powerful integration into the editor,
4:18 so be sure to pay attention to it.