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