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