From the course: Python: Recursion

Working with GitHub - Python Tutorial

From the course: Python: Recursion

Start my 1-month free trial

Working with GitHub

- [Instructor] Let's talk about how to use the GitHub repo along with this course. So, first of all, you're going to need to make sure that you have Git installed on your system. Now you can go to this URL. This is git-scm.com/downloads and you can see different versions for different systems. So the first thing you're going to need to do is go through that process of installing Git on your system. Once you have get installed, then you're going to want to clone the repository locally on your machine. I'll show you how to do that now. So I'm on Windows, and the way I'm going to do this is on my desktop which is where I want to create this repository. I'm going to hold down shift and right-click, and this will give me a context menu which includes the option to open up PowerShell Window. And what I'm going to do is from the GitHub repo itself you can see this green button here. What you can do is you can copy the URL for the repo, and then what you do once you have Git installed, is you do Git clone and then that address. Now I'm not actually going to do this because I've already got it installed. What will happen is if you do that then the location where you have executed that clone command, the folder will be created and that will include the entire repository. Then you have different options in terms of opening up in IDE, for example, PyCharm has the option of a context menu where you can right click on a folder and just create the project from doing that. My current installation doesn't have that option but it's a very handy option to select when you first installed PyCharm. Another alternative is simply to open up PyCharm normally and create a new project, navigate to the photo that you've just created, and proceed as you normally would create your new project. So that's how to get the repository available locally, to have a local clone of it on your local machine. And then if you want to interact with that local version, what you can do is you can do it via terminal. So in PyCharm, if I do out F12, then it gives me a terminal here where I can do various Git commands. So for example, if I do Git status, okay, I can see I'm on branch 07_03E. A couple of things about the branches, so the initial branch is called main. So you would do, Git check out main. This would initially be checked out after you've cloned it, but just, if you want to get back to that initial state, so you could check out main and you could see are switched to the branch main. And that's where all the exercise files are, with none of the code completed. So that's kind of like the boilerplate versions of the templates of the code that we complete during the lessons. Let me just show you all the branches that we have in this repo. If you do Git branch hyphen A, you'll see all these different branches available, and the convention we've used this for the beginning of a video, we have the branch ending in B. So for chapter two, video one, we have 02_01B, that's the initial state before the video. And then once the video has been completed there might be some changes to the code and that will be on a branch that ends with the same chapter number, but the E there instead. So for example, if you want to do chapter two, we can do Git checkout 02_01B, and then we follow along. And then if you want to compare that to the end result, Git checkout 02_01E, okay. And that's how it works. So you have these different branches that you can check out depending on what you want to achieve. If you want to just look at the final completed code then you can check out the very last commit, which is the Git, sorry the very last branch that I made, Git checkout that's going to be 09_02 and there's no beginning or end state to that particular one. So that's something I should mention actually, if there's no change within the video to the code then the branch for that video doesn't have a B or an E state, it just as the video number of the chapter underscore video number. So branch 09_02 contains all the complete code for all of the exercises that we've done in the course. And like I said, the initial exercise files with none of the exercises completed is on main. So that would be Git checkout main. Okay, and if you want to close up the terminal and PyCharm you just do out F12 and get back to whatever you were doing. If for any reason you want to work purely on GitHub, then you can switch branches very easily on GitHub itself. So you see here on the left I have this button currently I'm on main that's the main brunch. And I can actually just click on any particular branch that I want to check out. So if I want to check out 07_01B that's the beginning state of chapter seven video one, and the code here will be in its initial unfinished state. And then if I want to see the end state, I would check out the end version of that one. Okay, so it's very easy to change branch actually on GitHub itself.

Contents