Mastering 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:01 So we're back here in PyCharm with everything checked in
0:05 notice they are white, our files are white
0:07 that means that they are either ignored or they're up to date in git,
0:11 and if we right click on them, you can see that we have git operations,
0:15 so hey, they must be tracked by git.
0:17 Okay, so this is all good,
0:19 now let's just go fool around a little bit,
0:21 like let's suppose we want to have a function,
0:23 I'll do it down here, let's say def show header, I'll put this down here,
0:29 and say show header, okay, that's cool
0:33 and then this download info that's fine,
0:36 maybe you want to make this a function as well,
0:38 we could refactor it later, and when we talk about that we will
0:40 but let's say display results,
0:43 we'll run a little cleanup on it, this is all good.
0:49 Okay, so we can come over here and notice a few things,
0:55 again, our program file turned blue, that means there were some changes
0:58 we could go and see how those are different, like view the history here
1:03 we could actually right click and say git
1:07 and say compare with that and see the actual changes we've made
1:12 and this stuff is added down here and things like this.
1:16 So that's all well and good, but if you look carefully,
1:19 there's actually more going on, so notice right here,
1:22 there's a green line, so what does that mean?
1:26 If we click it, it says basically these green lines here
1:31 show you what has changed in this source file
1:34 compared to the git repository version
1:38 so we can jump from change the change,
1:41 we can revert it, roll it back or we could show the difference.
1:44 So notice we're just showing the difference of this little bit,
1:48 maybe this is a thousand line file, we're not seeing a thousand lines,
1:51 we're just seeing this little bit that changed in that section.
1:56 You come down here, same thing, show me the difference,
1:59 look we used to say this, now we say—
2:02 just the way it lined up it looks not that different, but it is kind of different.
2:05 And we can even navigate, this is kind of useless in this little file here
2:09 but shows the next deference, shows the previous difference.
2:12 Down here, notice that we have another thing
2:16 we basically deleted that line as far as it's concerned
2:21 and it's just not a great diff comparison that really landed up there,
2:24 but you can see these little arrows mean this section was deleted
2:28 as far as like the diff is concerned.
2:30 Now if we go over here and we commit these
2:33 we don't have to push them to the repository,
2:35 I'll move it over to the side,
2:37 I'll call it factored into methods something like that,
2:42 so I'm going to commit it not actually push it.
2:45 Of course these changes are in our local git repo but not pushed yet
2:51 so no one else will see them.
2:53 So we can come over here to git and say git push.
2:57 If you want to do that hotkey, shift CMD K.
3:00 So we're going to push that one change in
3:03 and— wait for it, now we push those change up to github
3:09 and we actually have a nice factored version there.
3:11 So, you can see this editor actually has a bunch of really cool features
3:15 in that it will show you exactly what has changed
3:19 by looking at the gutter or whatever they call it, thing on left there.
3:24 So, super, super nice, the integration built in the editor.