Effective PyCharm Transcripts
Chapter: Source control
Lecture: Concept: Accessing source control
0:00 Let's review the high points of accessing source control from PyCharm no matter how you
0:06 open a project, whether you check it out using the open from Vcs or you
0:10 just open it from the file system like you normally would this automatically lights up the
0:14 source control in PyCharm And if you're on a git repo it will switch to
0:19 the git settings. If you're in subversion it'll do that and so on here.
0:22 We have a Git repository and we have this main git action menu item here with
0:29 the stuff at the top which is also in the toolbar and a whole bunch of
0:31 other things and even special git hub details that we can work with like syncing or
0:37 for or creating and pull requests and so on.
0:40 So when we're in the editor we have a couple of places we can quickly access
0:44 source control in addition to the hotkey's.
0:47 So in the top here we have our pull bar that has the common actions.
0:51 We have poll, we have commit a push and we have show history or show
0:58 the log and then finally if we made some changes,
1:01 we don't like the way it went.
1:02 We can just roll one or more files back and if you have a bunch of
1:06 changes across different files you get a dialogue to say actually only roll back these two
1:10 files if you wish. So a lot of granularity there another aspect of source control
1:16 and git especially as a branching.
1:17 So down here at the bottom we have our branch operations.
1:21 You can see it's on main currently if you click that,
1:23 it'll pull up a whole bunch of options.
1:25 Like if I want to merge one branch into another.
1:27 I want to check out a certain branch or sync branches and even delete them if
1:33 we want to update our project that is effectively do a git pull take all the
1:37 changes from the server and bring them down.
1:39 So we have the latest working copy we can hit update project and the first time
1:44 you see this dialogue, do you want to merge incoming changes into your current branch
1:48 or re base it? Another thing this will do,
1:51 which we haven't really talked about yet because we haven't talked about branching is if there's
1:55 new branches on the server, this will refresh the branch list and give you a
2:00 list of new branches you might want to check out.
2:03 So it doesn't just update code but it kind of updates the state of the repository
2:07 entirely. Once you've made some changes,
2:10 you're ready to push them back.
2:12 So here's a file called engine.py We've made some more checks around the template
2:18 folder apparently. And you can see we actually get a comparison of the changes that
2:22 we're going to push in. So the one on the left is what's on the
2:25 server and the one on the right is the changes we're going to make.
2:28 Also notice there's a little check boxes in this list here.
2:32 I can commit say the change online.
2:35 26 without committing the change online 28 and keep that as a separate commit,
2:40 which is pretty awesome. Also up on the top right notice that you can,
2:45 before you commit automatically reformat code,
2:48 rearrange code, optimized imports and do it.
2:51 There's a big scroll bar there that is a whole bunch of things that you can
2:54 check out. So there's a lot of power in this check in dialog right here